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. Hi there every one, here every person is sharing these kinds
    of familiarity, thus it’s good to read this blog, and I
    used to visit this webpage all the time.

  2. Hmm it looks like your site ate my first comment (it was extremely long) so I guess I’ll just sum
    it up what I had written and say, I’m thoroughly
    enjoying your blog. I too am an aspiring blog writer but I’m still new to the whole thing.
    Do you have any suggestions for novice blog writers?
    I’d definitely appreciate it.

  3. I’m curious to find out what blog system you’re using?
    I’m experiencing some small security problems with my latest blog and I’d like to find something more
    safeguarded. Do you have any suggestions?

  4. Very great post. I simply stumbled upon your blog and wanted to mention that I have really enjoyed browsing your blog posts.
    After all I will be subscribing to your rss feed and I
    am hoping you write again very soon!

  5. Hey there would you mind stating which blog platform you’re using?
    I’m going to start my own blog in the near future but I’m having a hard time selecting between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your design and style seems different then most blogs and I’m looking for something unique.
    P.S Apologies for getting off-topic but I had
    to ask!

  6. Hey there! I just wanted to ask if you ever have any problems
    with hackers? My last blog (wordpress) was hacked and I ended up losing several weeks of
    hard work due to no data backup. Do you have any solutions to protect against hackers?

  7. Hola! I’ve been following your blog for a long time now
    and finally got the bravery to go ahead and give you
    a shout out from Austin Texas! Just wanted to mention keep up the good job!

  8. If some one wants to be updated with newest technologies after that
    he must be pay a visit this web site and be up to
    date daily.

  9. Hi there just wanted to give you a brief heads up
    and let you know a few of the pictures aren’t loading correctly.
    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.

  10. Hello there, I found your blog via Google while looking for a related matter, your web site got
    here up, it looks good. I’ve bookmarked it in my google bookmarks.

    Hello there, just become aware of your blog through Google,
    and located that it’s truly informative. I am going to watch out for brussels.
    I will be grateful should you continue this in future.
    Many people might be benefited out of your writing.
    Cheers!

  11. Howdy this is somewhat of off topic but I was wondering
    if blogs use WYSIWYG editors or if you have to manually code with HTML.
    I’m starting a blog soon but have no coding knowledge so I wanted to get guidance from someone with experience.
    Any help would be greatly appreciated!

  12. I’ve been exploring for a little bit for any high-quality articles
    or blog posts in this kind of area . Exploring in Yahoo I ultimately
    stumbled upon this website. Reading this info So i am happy
    to convey that I have an incredibly excellent uncanny feeling I found out
    just what I needed. I such a lot definitely will make certain to don?t
    forget this website and give it a glance regularly.

  13. Hello! I know this is kinda off topic however I’d
    figured I’d ask. Would you be interested in trading links or maybe guest authoring a blog post or vice-versa?
    My blog goes over a lot of the same subjects as yours and I feel 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! Fantastic blog by the way!

  14. Do you have a spam problem on this website; I also am a blogger, and I was wondering your situation; we have developed some nice
    methods and we are looking to swap solutions with other folks, be sure to shoot me an e-mail if interested.

  15. Hey there excellent blog! Does running a blog such as this require a large amount of
    work? I have no expertise in computer programming however I was hoping to start my own blog in the near future.

    Anyways, should you have any suggestions or tips for new blog owners please share.
    I know this is off subject however I simply wanted to ask.

    Kudos!

  16. I’ve 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 web owners and bloggers made good content as you did, the internet will be a lot more useful than ever before.

  17. When I initially commented I seem to have clicked on the
    -Notify me when new comments are added- checkbox and now whenever a
    comment is added I receive four emails with the exact same
    comment. Perhaps there is a means you are able to remove me from that service?

    Appreciate it!

  18. This design is steller! You most certainly 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 loved what you had to say, and more than that, how you
    presented it. Too cool!

  19. very interesting review. Moreover visit our site to have enjoyment from slot pulsa.
    The web-site has received acceptance from slot online pulsa gambling consumers in Indonesia.

    At this time there will be plenty of attractive promos
    predicament join right now.

  20. Does your blog have a contact page? I’m having a tough time locating
    it but, I’d like to send you an e-mail. I’ve got some creative ideas for your blog you might
    be interested in hearing. Either way, great website and I look forward to seeing it
    develop over time.

  21. Hi there! I know this is kinda off topic however I’d figured I’d
    ask. Would you be interested in trading links or maybe guest writing a blog
    article or vice-versa? My blog covers a lot of the same subjects as
    yours and I think we could greatly benefit from each other.
    If you might be interested feel free to shoot me an email.
    I look forward to hearing from you! Terrific
    blog by the way!

  22. First of all I would like to say wonderful blog! I had a quick question which I’d like
    to ask if you don’t mind. I was interested to know how you center yourself and clear your mind before writing.
    I’ve had difficulty clearing my thoughts in getting my ideas out.
    I truly do take pleasure in writing however it just seems like the
    first 10 to 15 minutes are usually wasted just trying to figure
    out how to begin. Any ideas or tips? Thanks!

  23. It’s nearly impossible to find experienced people about this subject, however, you
    seem like you know what you’re talking about! Thanks

  24. Currently it sounds like BlogEngine is the preferred blogging platform available right now.
    (from what I’ve read) Is that what you’re using on your blog?

  25. 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 waste your intelligence on just posting videos to your site when you could be giving us something informative to read?

  26. Hi! This is my first comment here so I just wanted to give a quick shout out and tell you I really
    enjoy reading through your articles. Can you recommend any other blogs/websites/forums that cover the same subjects?
    Thank you!

Comments are closed.