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. I’m not sure why but this web site is loading extremely slow for me.

    Is anyone else having this issue or is it a issue on my end?
    I’ll check back later and see if the problem still exists.

  2. Simply wish to say your article is as surprising.
    The clarity in your post is simply cool and that i can suppose you are knowledgeable on this subject.
    Well along with your permission let me to take hold of your feed to stay up to date
    with coming near near post. Thanks one million and please carry on the rewarding work.

  3. This design is wicked! You definitely 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!) Excellent job.
    I really enjoyed what you had to say, and more than that, how you presented it.

    Too cool!

  4. Good day very cool blog!! Guy .. Excellent ..
    Wonderful .. I will bookmark your website and take the feeds also?
    I’m happy to seek out a lot of useful information right here in the post, we’d like work out more strategies on this regard, thank you for sharing.
    . . . . .

  5. Howdy exceptional website! Does running a blog similar to this require a
    large amount of work? I’ve no knowledge of computer programming however I had been hoping to start my own blog in the
    near future. Anyway, if you have any suggestions or tips for new blog owners please share.
    I know this is off subject however I just wanted to ask.

    Kudos!

  6. After I initially left a comment I appear to have
    clicked the -Notify me when new comments are added- checkbox and from now on every
    time a comment is added I recieve 4 emails with the exact same comment.
    Is there a way you are able to remove me from that service?
    Thanks a lot!

  7. Spot on with this write-up, I actually believe that this web site needs
    a lot more attention. I’ll probably be returning to see
    more, thanks for the advice!

  8. I’ll immediately take hold of your rss as I can not in finding your e-mail subscription hyperlink
    or e-newsletter service. Do you’ve any? Kindly permit me recognise so that I
    may just subscribe. Thanks.

  9. An intriguing discussion is definitely worth comment.
    I do think that you should publish more about this issue, it
    might not be a taboo matter but generally people do not discuss such topics.

    To the next! Cheers!!

  10. Please let me know if you’re looking for a article author for your site.
    You have some really great posts and I believe I would be
    a good asset. If you ever want to take some of the load
    off, I’d absolutely love to write some articles for your blog in exchange for a link back to mine.
    Please send me an email if interested. Kudos!

  11. I was very pleased to find this great site. I
    want to to thank you for ones time for this wonderful read!!
    I definitely really liked every part of it and i also have you saved as a favorite to see new information on your web site.

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

  13. I like the helpful information you provide in your articles.
    I will bookmark your blog and check again here frequently.
    I’m quite sure I will learn a lot of new stuff right here!
    Best of luck for the next!

  14. I am curious to find out what blog platform you
    happen to be using? I’m having some minor security
    problems with my latest blog and I would like to find something more safeguarded.
    Do you have any solutions?

  15. My spouse and I stumbled over here by a different page and thought I might as well check things
    out. I like what I see so now i am following
    you. Look forward to finding out about your web page yet
    again.

  16. Oh my goodness! Incredible article dude! Thanks, However I
    am having difficulties with your RSS. I don’t know the reason why I cannot join it.
    Is there anybody getting similar RSS issues? Anyone that knows the answer will you kindly respond?
    Thanx!!

  17. I am extremely impressed along with your writing
    skills and also with the structure for your blog.

    Is that this a paid subject or did you modify it your self?
    Either way keep up the excellent quality writing,
    it is rare to see a nice weblog like this one today..

  18. Hey there! I know this is somewhat off topic but I was wondering if you knew where I could locate
    a captcha plugin for my comment form? I’m using the same blog platform as yours and I’m having trouble finding one?
    Thanks a lot!

  19. A motivating discussion is definitely worth comment.
    I believe that you ought to publish more on this subject matter,
    it might not be a taboo subject but usually people don’t discuss such subjects.
    To the next! Kind regards!!

  20. After I originally left a comment I appear to have clicked the
    -Notify me when new comments are added- checkbox and
    from now on every time a comment is added I
    get four emails with the same comment. There has to be
    a way you can remove me from that service? Appreciate it!

  21. I do not even know how I ended up here, but
    I thought this post was good. I don’t know who you are but certainly you are going to a famous blogger if
    you are not already 😉 Cheers!

  22. It is in reality a great and helpful piece of information. I am happy that you just
    shared this useful information with us. Please keep us informed
    like this. Thanks for sharing.

  23. My partner and I absolutely love your blog and find the majority of
    your post’s to be exactly what I’m looking for. Does one
    offer guest writers to write content in your case? I wouldn’t mind writing
    a post or elaborating on some of the subjects you write concerning here.
    Again, awesome blog!

  24. Wow, incredible blog structure! How lengthy have you been blogging for?
    you make running a blog glance easy. The total glance of your site is magnificent, as neatly as the content material!

  25. I am really impressed with your writing skills and also with the layout on your weblog.
    Is this a paid theme or did you customize it yourself? Either way keep up the nice quality writing, it’s rare to see a great blog
    like this one today.

  26. The other day, while I was at work, my sister stole my apple ipad and tested to see if
    it can survive a twenty five foot drop, just so she can be a youtube sensation. My iPad is now broken and she has 83 views.

    I know this is totally off topic but I had to share it with
    someone!

  27. 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 three e-mails with the same comment.
    Is there any way you can remove me from that
    service? Bless you!

  28. I know this if off topic but I’m looking into starting my own weblog and was
    wondering what all is required to get setup? I’m assuming
    having a blog like yours would cost a pretty penny?
    I’m not very web savvy so I’m not 100% sure. Any recommendations or advice would be greatly appreciated.
    Thank you

Comments are closed.