Contoh Soal Pemrograman – Pola Segitiga Siku-siku

Pemrograman Python

Pada posting sebelumnya sudah dicontohkan soal pemrograman dalam bahasa Python. Kali ini, akan ditampilkan lagi contoh berikutnya.

Soal:
Buatlah program Python untuk menampilkan pola segitiga siku-siku menggunakan forin.

Jawab:

Pola 1

*  *  *  *  *  *
*  *  *  *  *
*  *  *  *
*  *  *
*  *
*

Jawab:

siku_siku_1.py
tinggi = 6

for baris in range(0, tinggi):
    for kolom in range(0, tinggi-baris):
        print("*", end=" ")
    print("")

 

Pola 2

*
*  *
*  *  *
*  *  *  *
*  *  *  *  *
*  *  *  *  *  *

Jawab:

siku_siku_2.py
tinggi = 6

for baris in range(0, tinggi):
    for kolom in range(0, baris+1):
        print("*", end=" ")
    print("")

Pola 3

               *
            *  *
         *  *  *
      *  *  *  *
   *  *  *  *  *
*  *  *  *  *  *

Jawab:

siku_siku_3.py
tinggi = 6

for baris in range(0, tinggi):
    for kolom in range(1, tinggi-baris):
        print(" ", end=" ")
    for bintang in range(0, baris+1):
        print("*", end=" ")
    print("")

Demikian contoh pola segitiga dalam pemrograman Python. Semoga bermanfaat.

48,210 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. My spouse and I stumbled over here by a different page and thought I might check things out.
    I like what I see so now i am following you. Look forward to looking over
    your web page again.

  2. Magnificent beat ! I would like to apprentice at the same time
    as you amend your website, how could i subscribe
    for a weblog website? The account aided me a applicable deal.
    I have been tiny bit familiar of this your broadcast offered brilliant transparent concept

  3. I’m extremely impressed along with your writing abilities as
    smartly as with the structure for your blog. Is that this a
    paid theme or did you modify it yourself? Anyway keep up
    the excellent high quality writing, it’s uncommon to peer a
    great blog like this one nowadays..

  4. Today, I went to the beach front with my kids. I found a sea shell and
    gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She placed the shell to her ear and screamed.
    There was a hermit crab inside and it pinched her ear.
    She never wants to go back! LoL I know this is totally off topic but I had to tell someone!

  5. Today, I went to the beach with my children. I found a sea shell and
    gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell to her ear and screamed.

    There was a hermit crab inside and it pinched her ear.
    She never wants to go back! LoL I know this is entirely off
    topic but I had to tell someone!

  6. Wonderful beat ! I would like to apprentice while you amend your site, how could i subscribe for a blog web site?
    The account helped me a acceptable deal. I had been tiny bit acquainted of this your broadcast offered bright
    clear concept

  7. I’m not that much of a internet reader to be honest but your sites really nice, keep it
    up! I’ll go ahead and bookmark your site to come back later on. All the best

  8. This design is spectacular! You obviously know
    how to keep a reader amused. Between your wit and your videos, I
    was almost moved to start my own blog (well, almost…HaHa!)
    Wonderful job. I really enjoyed what you had to say,
    and more than that, how you presented it. Too cool!

  9. Hey I am so delighted I found your site, I really found you by error, while I
    was researching on Yahoo for something else, Regardless I am here now and would just like
    to say kudos for a marvelous post and a all round enjoyable blog (I
    also love the theme/design), I don’t have time to go through it all at the minute but I
    have bookmarked it and also added your RSS feeds, so when I have time I will be back to read much more,
    Please do keep up the great job.

  10. I really love your blog.. Great colors & theme. Did you develop this web site yourself?
    Please reply back as I’m wanting to create my very own site and would like to find out where you
    got this from or just what the theme is named. Appreciate it!

  11. I do not know whether it’s just me or if everybody
    else encountering issues with your website. It looks like some of the written text within your content are
    running off the screen. Can somebody else please comment
    and let me know if this is happening to them as well? This may be a problem with my web
    browser because I’ve had this happen before. Thanks

  12. Fantastic beat ! I wish to apprentice even as you amend your website, how could i subscribe for a weblog
    site? The account aided me a appropriate deal. I were
    tiny bit acquainted of this your broadcast offered
    brilliant transparent idea

  13. I just couldn’t go away your website before suggesting that I extremely loved
    the standard info an individual provide in your visitors?
    Is gonna be again often to inspect new posts

  14. Excellent post. I was checking continuously this blog and I
    am impressed! Extremely useful information specially the last part šŸ™‚ I care for such
    information a lot. I was seeking this certain information for a
    long time. Thank you and best of luck.

  15. Thank you for sharing your thoughts. I really appreciate your
    efforts and I am waiting for your next post thanks
    once again.

  16. You have made some good points there. I looked on the net to learn more about the issue and found most people will go
    along with your views on this web site.

  17. Greetings! Quick question that’s totally off topic.
    Do you know how to make your site mobile friendly?

    My blog looks weird when browsing from my apple iphone.
    I’m trying to find a template or plugin that might be able to resolve this problem.
    If you have any recommendations, please share.
    Many thanks!

  18. It is appropriate time to make some plans for the future and it’s time to be happy.
    I have read this post and if I could I wish to suggest you
    few interesting things or suggestions. Perhaps you
    can write next articles referring to this article.
    I want to read even more things about it!

  19. When I originally commented I clicked the “Notify me when new comments are added”
    checkbox and now each time a comment is added I get several emails with the same
    comment. Is there any way you can remove me from that service?
    Bless you!

  20. Hi there, just became alert to your blog through Google,
    and found that it is truly informative. I’m going to watch out for brussels.
    I’ll appreciate if you continue this {in future}. Lots of people will be benefited from your writing.
    Cheers!

  21. Can I just say what a relief to uncover a person that actually understands what they are
    discussing online. You actually realize how to
    bring a problem to light and make it important.
    More people ought to read this and understand this side of
    your story. I can’t believe you aren’t more popular since you definitely have
    the gift.

  22. I like the helpful information you provide in your articles.
    I will bookmark your blog and check again here regularly.
    I am quite certain I will learn lots of new stuff
    right here! Best of luck for the next!

  23. whoah this weblog is wonderful i really like reading
    your articles. Keep up the good work! You know, lots of people are hunting around for this info, you could aid
    them greatly.

  24. I’m amazed, I have to admit. Rarely do I encounter a blog that’s both educative and interesting, and let me tell you,
    you have hit the nail on the head. The issue is an issue that too few folks are speaking intelligently about.
    I am very happy that I came across this during my hunt for
    something relating to this.

  25. After going over a number of the blog posts on your web site, I seriously like your way of writing a blog.

    I book marked it to my bookmark website list and will
    be checking back in the near future. Please check out my web site as well
    and let me know how you feel.

  26. Valuable info. Fortunate me I discovered your web site by accident,
    and I am stunned why this twist of fate did not took place earlier!
    I bookmarked it.

  27. What i don’t understood is actually how you’re no longer actually much more smartly-favored
    than you might be right now. You’re very intelligent.
    You realize therefore significantly in the case of this topic,
    made me in my opinion imagine it from numerous numerous angles.
    Its like men and women are not involved until it is one thing to accomplish with Lady gaga!

    Your own stuffs outstanding. All the time maintain it up!

Comments are closed.