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. Simply wish to say your article is as surprising.
    The clearness in your post is simply spectacular and i can assume you are an expert on this subject.
    Fine with your permission allow me to grab your feed to
    keep updated with forthcoming post. Thanks a million and please continue the rewarding work.

  2. Heya outstanding website! Does running a blog similar to this require a large amount of work?
    I’ve absolutely no knowledge of computer programming however I had been hoping
    to start my own blog soon. Anyhow, should you have any recommendations or techniques
    for new blog owners please share. I know this is off topic nevertheless I
    just needed to ask. Thank you!

  3. Heya just wanted to give you a brief heads up and let you know
    a few of the images aren’t loading properly. I’m not sure
    why but I think its a linking issue. I’ve tried it in two
    different browsers and both show the same results.

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

  5. Attractive section of content. I just stumbled upon your weblog and in accession capital to assert that I acquire actually enjoyed
    account your blog posts. Any way I’ll be subscribing to your augment
    and even I achievement you access consistently fast.

  6. I’m really inspired along with your writing skills as well as with the format to your weblog.
    Is this a paid subject matter or did you modify it your self?
    Anyway stay up the nice high quality writing, it’s rare to look a
    nice blog like this one nowadays..

  7. I’m really inspired together with your writing skills as well as with
    the format to your weblog. Is that this a paid theme or did you modify it yourself?

    Either way keep up the excellent quality writing, it is
    uncommon to peer a nice blog like this one nowadays..

  8. I’m very pleased to uncover this website. I wanted to thank
    you for your time for this particularly wonderful read!!

    I definitely loved every little bit of it and I have
    you saved to fav to check out new things in your web site.

  9. Hey I know this is off topic but I was wondering
    if you knew of any widgets I could add to my blog that automatically tweet my newest twitter updates.
    I’ve been looking for a plug-in like this for quite some time and was hoping maybe you would have
    some experience with something like this. Please let me know if you run into anything.
    I truly enjoy reading your blog and I look forward to your new updates.

  10. You actually make it seem so easy along with your presentation but
    I to find this matter to be actually something which I believe
    I’d never understand. It sort of feels too complex and extremely extensive for me.

    I’m having a look forward for your next put up, I will try to
    get the grasp of it!

  11. I do accept as true with all the ideas you have presented
    on your post. They are very convincing and can definitely work.

    Still, the posts are very brief for novices. May just you please extend them a bit from next
    time? Thank you for the post.

  12. What i don’t realize is if truth be told how you are no longer
    really much more neatly-appreciated than you might be now.
    You are very intelligent. You recognize thus significantly on the subject of
    this matter, produced me for my part imagine it from
    a lot of varied angles. Its like women and men are not involved unless it is one thing to
    accomplish with Girl gaga! Your individual stuffs great.
    All the time take care of it up!

  13. I absolutely love your blog.. Very nice colors & theme.
    Did you develop this web site yourself? Please reply back
    as I’m looking to create my own personal site and would like to know
    where you got this from or what the theme is called.
    Thanks!

  14. Do you have a spam problem on this website; I also am a blogger, and I was wondering
    your situation; many of us have created some nice procedures and we are looking to exchange solutions with other folks, be sure to shoot me an email if interested.

  15. Having read this I thought it was extremely informative.
    I appreciate you finding the time and energy to put this information together.
    I once again find myself spending a significant amount of time both reading and commenting.
    But so what, it was still worth it!

  16. I have been browsing online more than 3 hours as of late, but I never found any attention-grabbing article like yours.
    It’s lovely value sufficient for me. In my opinion, if all site owners and bloggers made just right content as you
    did, the internet shall be much more useful than ever before.

  17. Thanks , I’ve recently been looking for info about this topic for a while and yours is the greatest I
    have found out so far. But, what about the conclusion? Are you positive about the
    source?

  18. 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 four e-mails with the same comment. Is there any way you can remove people from that
    service? Thanks!

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

  20. 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 user friendliness and
    visual appeal. I must say you’ve done a amazing job with this.
    Also, the blog loads super fast for me on Safari. Superb Blog!

  21. I feel this is among the most important information for me.
    And i’m satisfied studying your article. But want
    to observation on few basic things, The website style is perfect,
    the articles is really nice : D. Just right task, cheers

  22. Hello! I know this is kind of off-topic however I needed to ask.

    Does running a well-established website such as yours take a large amount of work?
    I am brand new to operating a blog but I do write in my journal everyday.
    I’d like to start a blog so I can easily share my own experience and thoughts online.
    Please let me know if you have any recommendations or tips for brand new aspiring bloggers.
    Thankyou!

  23. Hi there! This is my first visit to your blog!

    We are a team of volunteers and starting a new project
    in a community in the same niche. Your blog provided us
    valuable information to work on. You have done a outstanding job!

  24. I know this if off topic but I’m looking into starting my own blog and was curious what all is needed to get set up?
    I’m assuming having a blog like yours would cost a pretty penny?
    I’m not very web savvy so I’m not 100% positive. Any tips or advice would be greatly appreciated.
    Thank you

Comments are closed.