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. Good day! I could have sworn I’ve been to this website before but after browsing through some of the post I realized it’s new to
    me. Nonetheless, I’m definitely delighted I found it
    and I’ll be book-marking and checking back frequently!

  2. Greetings! Quick question that’s entirely off topic.
    Do you know how to make your site mobile friendly? My web site looks weird when viewing from my iphone.

    I’m trying to find a template or plugin that might be able to resolve this issue.

    If you have any suggestions, please share. Thanks!

  3. Hey there! I know this is kinda off topic but I was wondering which blog platform are you using for this website?
    I’m getting sick and tired of WordPress because I’ve had issues with hackers and I’m looking at alternatives for another
    platform. I would be great if you could point me in the direction of a good platform.

  4. Hello i am kavin, its my first time to commenting anywhere, when i read this post i thought
    i could also make comment due to this sensible paragraph.

  5. Do you mind if I quote a couple of your posts as long as I provide credit and sources
    back to your weblog? My website is in the very same niche
    as yours and my users would truly benefit from a lot of the information you provide here.
    Please let me know if this okay with you. Regards!

  6. Heya i am for the first time here. I came across this board and I find It truly helpful & it
    helped me out a lot. I am hoping to present one
    thing back and help others like you aided me.

  7. Hi, i think that i saw you visited my website
    thus i came to go back the choose?.I am attempting to to find things
    to enhance my site!I assume its ok to make use of a few of your ideas!!

  8. Hello There. I found your blog using msn. This is a really well written article.
    I’ll be sure to bookmark it and return to read more of your useful information.
    Thanks for the post. I’ll certainly return.

  9. Hi there! This post couldn’t be written any better!
    Reading through this post reminds me of my previous roommate!
    He continually kept preaching about this. I most certainly will forward this article to him.
    Fairly certain he’ll have a great read. I appreciate you for sharing!

  10. Asking questions are truly nice thing if you are not understanding something totally, except this article offers fastidious understanding even.

  11. Greetings, There’s no doubt that your web site could be having internet browser compatibility issues.
    When I take a look at your site in Safari, it looks fine however
    when opening in Internet Explorer, it’s got some overlapping issues.
    I just wanted to give you a quick heads up! Apart from that, excellent
    blog!

  12. Hi, I do believe this is a great web site. I stumbledupon it 😉
    I’m going to return once again since i have book marked it.
    Money and freedom is the greatest way to change, may you be rich and continue to guide others.

  13. Somebody necessarily lend a hand to make critically
    posts I might state. That is the very first time I frequented your web page and thus far?
    I surprised with the analysis you made to create this particular publish amazing.

    Excellent job!

  14. Howdy I am so delighted I found your blog page, I really found you by error,
    while I was browsing on Digg for something else, Nonetheless
    I am here now and would just like to say cheers for a remarkable post and a all round interesting blog (I also love the theme/design), I don’t have time to read it
    all at the moment but I have bookmarked it and also added in your RSS feeds,
    so when I have time I will be back to read
    much more, Please do keep up the superb work.

  15. This is very interesting, You are a very skilled blogger.
    I’ve joined your rss feed and look forward to seeking more
    of your magnificent post. Also, I’ve shared your site in my social networks!

  16. My brother recommended I may like this web site. He was once entirely right.
    This submit actually made my day. You can not consider just how much time
    I had spent for this information! Thank you!

  17. I just like the helpful information you provide in your articles.
    I’ll bookmark your blog and test again here regularly. I’m somewhat sure I’ll learn plenty of new stuff right
    right here! Good luck for the next!

  18. Good post. I learn something new and challenging on blogs I stumbleupon everyday.
    It’s always exciting to read through articles from other writers and use a little something
    from their web sites.

  19. you’re really a just right webmaster. The site loading pace is amazing.
    It seems that you’re doing any unique trick.

    Furthermore, The contents are masterpiece. you’ve done a wonderful
    activity on this topic!

  20. Howdy! I know this is kinda off topic nevertheless
    I’d figured I’d ask. Would you be interested in trading links
    or maybe guest writing a blog article or vice-versa?
    My site discusses a lot of the same subjects as yours and I believe we could greatly benefit from each other.

    If you are interested feel free to shoot me an e-mail. I look forward to hearing from you!
    Excellent blog by the way!

  21. What i do not realize is actually how you are now not actually much more smartly-favored than you might be right now.
    You’re very intelligent. You recognize thus considerably
    in terms of this topic, produced me in my opinion consider it from numerous varied angles.
    Its like men and women aren’t involved except it is one thing to accomplish with Woman gaga!
    Your own stuffs great. At all times deal with it up!

  22. It is in point of fact a great and useful piece of info.
    I am satisfied that you shared this helpful info with us.
    Please stay us informed like this. Thanks for sharing.

  23. A fascinating discussion is worth comment. I think that you ought to write more about this topic, it might not be a
    taboo matter but usually people do not talk about such topics.
    To the next! Kind regards!!

  24. Asking questions are really fastidious thing if
    you are not understanding something completely, but this paragraph gives good understanding yet.

  25. I simply couldn’t leave your site before suggesting that I really enjoyed
    the usual information an individual supply in your guests?
    Is gonna be back steadily to investigate cross-check new posts

  26. I like the helpful information you provide in your articles.
    I will bookmark your blog and check again here regularly.
    I’m quite certain I’ll learn plenty of new stuff right here!
    Good luck for the next!

  27. Normally I do not learn post on blogs, but I would like to say that this write-up very forced me to check out
    and do so! Your writing taste has been amazed me.
    Thank you, very nice post.

Comments are closed.