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. Woah! I’m really loving the template/theme of this blog. It’s simple, yet effective.
    A lot of times it’s challenging to get that “perfect balance” between usability and visual appeal.
    I must say that you’ve done a fantastic job with this. In addition, the blog loads extremely quick for me on Safari.
    Outstanding Blog!

  2. I have been surfing online more than 3 hours today, yet I
    never found any interesting article like yours.
    It is pretty worth enough for me. In my view, if all site
    owners and bloggers made good content as you did, the web will
    be a lot more useful than ever before.

  3. Great blog! Do you have any tips and hints for aspiring writers?
    I’m hoping to start my own blog soon but I’m a little lost on everything.

    Would you suggest starting with a free platform like WordPress or go for a paid option? There are
    so many choices out there that I’m totally confused ..
    Any recommendations? Many thanks!

  4. Excellent post. I was checking constantly this blog and I
    am impressed! Very useful information particularly
    the last part 🙂 I care for such information much. I was looking for this particular info for a very long time.

    Thank you and best of luck.

  5. I am sure this article has touched all the internet visitors, its really really pleasant piece of writing on building up new weblog.

  6. Awesome blog! Is your theme custom made or did you download it from
    somewhere? A theme like yours with a few simple adjustements would really make my blog stand out.
    Please let me know where you got your theme. Thanks

  7. Hello i am kavin, its my first occasion to commenting anywhere, when i read
    this piece of writing i thought i could also make comment due to this brilliant article.

  8. When I initially commented I clicked the “Notify me when new comments are added” checkbox and
    now each time a comment is added I get three emails with the same comment.
    Is there any way you can remove people from that service? Appreciate it!

  9. Greetings from Idaho! I’m bored to tears at work so I decided to
    check out your site on my iphone during lunch break.
    I enjoy the knowledge you provide here and can’t wait to take a look when I get home.
    I’m shocked at how quick your blog loaded on my phone
    .. I’m not even using WIFI, just 3G .. Anyways, very good blog!

  10. Thank you for sharing your thoughts. I really
    appreciate your efforts and I will be waiting for
    your next write ups thanks once again.

  11. Howdy just wanted to give you a quick heads up. The words in your post seem to be running off the screen in Chrome.
    I’m not sure if this is a format issue or something to do
    with internet browser compatibility but I figured I’d post to let you know.
    The design look great though! Hope you get the issue fixed soon. Thanks

  12. It’s appropriate time to make some plans for the longer term
    and it is time to be happy. I’ve read this put up
    and if I may I wish to suggest you some fascinating issues
    or suggestions. Maybe you could write subsequent articles relating
    to this article. I want to learn more things about it!

  13. Its such as you read my mind! You seem to know so much approximately this,
    like you wrote the ebook in it or something. I think that you can do with a few % to pressure the message home a little bit, but other than that, that is magnificent blog.
    A great read. I will certainly be back.

  14. I will immediately take hold of your rss feed as I can’t in finding your email subscription hyperlink or newsletter service.
    Do you have any? Kindly permit me realize so that I could subscribe.
    Thanks.

  15. I have been surfing online more than three hours today, yet I
    never found any interesting article like yours.
    It is pretty worth enough for me. In my opinion, if all site owners and bloggers made good content as you did, the internet will be a lot
    more useful than ever before.

  16. Ahaa, its fastidious discussion concerning this post here at
    this website, I have read all that, so at this time me also commenting at this place.

  17. Greetings from California! I’m bored to death at work so
    I decided to check out your blog on my iphone during lunch break.
    I really like the info you present here and can’t wait to take a look
    when I get home. I’m amazed at how fast your blog loaded on my mobile ..
    I’m not even using WIFI, just 3G .. Anyhow, very good blog!

  18. Everyone loves what you guys tend to be up too. This
    sort of clever work and exposure! Keep up the good works guys I’ve added you guys to my blogroll.

  19. I needed to thank you for this good read!! I certainly
    loved every little bit of it. I have you book marked to look at new stuff you

  20. Attractive section of content. I just stumbled upon your site and in accession capital to
    assert that I get in fact enjoyed account your blog posts.

    Anyway I will be subscribing to your feeds and even I achievement you access consistently rapidly.

  21. I truly love your website.. Great colors & theme.

    Did you develop this website yourself? Please reply back
    as I’m attempting to create my own site and would love to know where you got this from or exactly what the theme is named.

    Thanks!

  22. It’s 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 some interesting things or tips.
    Perhaps you could write next articles referring to this article.
    I desire to read even more things about it!

  23. I have been surfing online more than three hours today, yet I never found any interesting article like yours.
    It is pretty worth enough for me. In my view, if all site
    owners and bloggers made good content as you did, the internet
    will be much more useful than ever before.

Comments are closed.