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.

6,700 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. Thanks for every other fantastic article. Where else may
    anyone get that type of info in such a perfect way of writing?
    I’ve a presentation subsequent week, and I am on the look for
    such information.

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

  3. naturally like your web site however you need to test the spelling on quite
    a few of your posts. Several of them are rife with spelling problems and I find it very bothersome to inform the reality
    on the other hand I’ll definitely come again again.

  4. The other day, while I was at work, my sister stole my iPad and tested to see if it
    can survive a 30 foot drop, just so she can be a youtube sensation. My iPad is now destroyed and she has 83 views.
    I know this is completely off topic but I had to share it with someone!

  5. I know this if off topic but I’m looking into starting my own weblog and was wondering what
    all is needed to get setup? I’m assuming having a blog like yours would cost a pretty penny?
    I’m not very internet savvy so I’m not 100% positive.
    Any suggestions or advice would be greatly appreciated. Thanks

  6. You really make it seem so easy with your presentation but I find this topic to be really something which I
    think I would never understand. It seems too complex and very broad for me.
    I am looking forward for your next post, I will try to get the
    hang of it!

  7. magnificent submit, very informative. I’m wondering why the other experts of this sector don’t notice this.
    You must proceed your writing. I’m confident, you’ve a huge readers’
    base already!

  8. Attractive section of content. I just stumbled upon your weblog and in accession capital to assert that I acquire in fact enjoyed account your
    blog posts. Anyway I will be subscribing to your feeds and
    even I achievement you access consistently rapidly.

  9. Hi! I could have sworn I’ve visited your blog before but after looking at a few of the articles I realized it’s new to me.

    Anyhow, I’m definitely delighted I discovered it and I’ll be bookmarking it and checking
    back regularly!

  10. Hello there, just became aware of your blog through Google, and found that it’s
    truly informative. I’m gonna watch out for brussels.

    I’ll appreciate if you continue this in future. A lot of people will be benefited from your writing.

    Cheers!

  11. Write more, thats all I have to say. Literally, it seems as though you relied on the
    video to make your point. You obviously know what youre talking about, why throw
    away your intelligence on just posting videos to
    your weblog when you could be giving us something
    informative to read?

  12. I was recommended this blog by my cousin. I’m not sure whether
    this post is written by him as nobody else know such detailed about my problem.
    You are wonderful! Thanks!

  13. You really make it seem so easy with your presentation but
    I find this matter to be actually something that I think I would never understand.
    It seems too complicated and extremely broad for me. I am looking forward for your next post,
    I will try to get the hang of it!

  14. Do you mind if I quote a few of your articles as long as I provide
    credit and sources back to your blog? My
    blog site is in the exact same niche as yours and my visitors
    would certainly benefit from a lot of the information you present here.
    Please let me know if this alright with you. Cheers!

  15. Fantastic items from you, man. I have take into accout your
    stuff prior to and you are just extremely magnificent.

    I really like what you’ve received right here, really like what you’re saying and the way in which during which you
    are saying it. You make it enjoyable and you continue to
    take care of to stay it wise. I cant wait to read much more from you.

    That is actually a tremendous site.

  16. Whoa! This blog looks exactly like my old one! It’s on a completely different topic but it has pretty much the same layout
    and design. Outstanding choice of colors!

  17. Thank you for another fantastic post. Where else may anybody get that type of info in such a perfect
    manner of writing? I have a presentation subsequent week, and I’m at the search for such information.

  18. Simply want to say your article is as amazing. The clearness in your post
    is simply cool and i can assume you’re an expert
    on this subject. Fine with your permission let me to
    grab your feed to keep up to date with forthcoming post. Thanks a million and please continue the rewarding work.

  19. Hi there are using WordPress for your blog platform? I’m
    new to the blog world but I’m trying to get started and create
    my own. Do you require any coding knowledge to make your own blog?

    Any help would be greatly appreciated!

  20. Hi! Quick question that’s entirely off topic. Do you know how to make your site mobile friendly?

    My site looks weird when browsing from my apple iphone.
    I’m trying to find a theme or plugin that might be able
    to correct this problem. If you have any suggestions, please share.
    Thanks!

  21. Heya outstanding website! Does running a blog such as this require a massive amount work?
    I’ve virtually no understanding of programming but I was
    hoping to start my own blog in the near future.
    Anyways, should you have any ideas or tips for new blog owners
    please share. I understand this is off subject however I just had to ask.

    Thanks a lot!

  22. Hey! Quick question that’s completely off topic.
    Do you know how to make your site mobile friendly? My site looks weird when browsing from my iphone.
    I’m trying to find a template or plugin that might be able
    to resolve this issue. If you have any recommendations, please share.
    With thanks!

  23. Hi! Do you know if they make any plugins to protect
    against hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any
    recommendations?

  24. I do consider all the ideas you’ve offered for your post.
    They are very convincing and can definitely work. Nonetheless, the posts are too
    brief for beginners. May you please prolong them a little
    from subsequent time? Thanks for the post.

  25. Oh my goodness! Awesome article dude! Thank you, However I am encountering problems with
    your RSS. I don’t understand why I can’t join it. Is there
    anybody else having similar RSS problems? Anybody who knows the answer can you kindly respond?
    Thanx!!

  26. I do believe all the concepts you have introduced on your post.
    They’re really convincing and will certainly work.
    Nonetheless, the posts are too short for newbies.
    May you please prolong them a little from next time? Thank you for
    the post.

Leave a Reply

Your email address will not be published. Required fields are marked *