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 know this if off topic but I’m looking into starting my own blog 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 smart
    so I’m not 100% certain. Any recommendations or advice
    would be greatly appreciated. Cheers

  2. I was suggested this blog by my cousin. I am not
    sure whether this post is written by him as nobody else know such detailed about my difficulty.
    You are amazing! Thanks!

  3. Great blog here! Also your web site loads up fast! What host
    are you using? Can I get your affiliate link to your host?
    I wish my web site loaded up as quickly as yours lol

  4. Hi! I understand this is somewhat off-topic however I had to ask.
    Does operating a well-established website like yours require a massive amount work?
    I’m brand new to blogging however I do write in my
    journal every day. I’d like to start a blog so I will be able to share my own experience and thoughts online.

    Please let me know if you have any suggestions or tips for new
    aspiring bloggers. Thankyou!

  5. If some one desires to be updated with newest technologies afterward
    he must be go to see this site and be up to date everyday.

  6. Its such as you read my mind! You seem to grasp a lot about this, like you wrote the book in it or something.
    I believe that you just can do with a few p.c.

    to force the message home a little bit, but instead of that, this
    is fantastic blog. A fantastic read. I will definitely be back.

  7. I am extremely impressed with your writing skills and also with the layout on your blog.
    Is this a paid theme or did you customize it yourself?

    Anyway keep up the nice quality writing, it’s rare to
    see a nice blog like this one today.

  8. 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!

  9. Hi, I believe your web site could be having browser compatibility issues.
    Whenever I take a look at your site in Safari, it
    looks fine but when opening in IE, it’s got some overlapping issues.
    I simply wanted to give you a quick heads up! Apart from
    that, fantastic site!

  10. Howdy! Quick question that’s entirely off topic.
    Do you know how to make your site mobile friendly? My web site looks
    weird when browsing from my apple iphone. I’m trying to find a theme or plugin that might be
    able to fix this problem. If you have any suggestions, please share.
    Thank you!

  11. I’m truly enjoying the design and layout of your blog. It’s a very easy on the eyes which makes it much more pleasant for
    me to come here and visit more often. Did you hire
    out a developer to create your theme? Outstanding work!

  12. Please let me know if you’re looking for a writer for your weblog.
    You have some really good posts and I feel I would be a good asset.
    If you ever want to take some of the load
    off, I’d love to write some material for your blog in exchange
    for a link back to mine. Please send me an e-mail if interested.
    Cheers!

  13. Thank you for the good writeup. It in truth was once a
    entertainment account it. Glance advanced to more introduced agreeable from you!
    However, how can we communicate?

  14. Hello there I am so happy I found your blog, I really found you by error, while I was searching
    on Aol for something else, Nonetheless I am here now and would just like
    to say thanks a lot for a remarkable post and a all round entertaining blog (I also love the
    theme/design), I don’t have time to look over it all at
    the moment but I have book-marked it and also included your
    RSS feeds, so when I have time I will be back to
    read more, Please do keep up the superb job.

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

  16. Nice post. I learn something new and challenging on websites I stumbleupon every day.
    It’s always helpful to read through content from
    other authors and practice something from their websites.

  17. Good day! This is my 1st comment here so I just wanted to give a
    quick shout out and tell you I truly enjoy reading your articles.
    Can you suggest any other blogs/websites/forums that deal with the same topics?
    Thank you so much!

  18. Simply desire to say your article is as amazing. The clearness in your post is just 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 I am so glad I found your site, I really found you by error, while I was browsing on Yahoo
    for something else, Anyways I am here now and would just like to say cheers
    for a incredible post and a all round enjoyable blog
    (I also love the theme/design), I don’t have time to go
    through it all at the moment but I have bookmarked it and also added your RSS feeds, so when I have time
    I will be back to read a great deal more, Please do
    keep up the awesome work.

  20. hello!,I like your writing very so much! share
    we communicate more approximately your post on AOL? I require a specialist in this space to unravel my problem.
    May be that’s you! Taking a look forward to see
    you.

  21. 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 receive four emails with the exact same
    comment. There has to be an easy method you can remove me
    from that service? Thank you!

  22. Definitely believe that which you said. Your favorite reason appeared to be on the web the simplest thing to
    be aware of. I say to you, I certainly get annoyed while people think about worries that they plainly don’t
    know about. You managed to hit the nail upon the top as well as
    defined out the whole thing without having side effect , people could take a signal.
    Will likely be back to get more. Thanks

  23. I am really impressed with your writing abilities and also
    with the layout on your blog. Is that this a paid subject or did you modify it yourself?
    Either way keep up the excellent high quality writing, it is rare to peer a
    great blog like this one nowadays..

  24. Great article! That is the type of info that are supposed to be shared across the internet.

    Shame on the search engines for no longer positioning this submit higher!
    Come on over and consult with my web site . Thank you =)

  25. Hi, I do think your web site could possibly be having browser compatibility issues.
    Whenever I take a look at your website in Safari,
    it looks fine but when opening in I.E.,
    it’s got some overlapping issues. I simply wanted
    to provide you with a quick heads up! Other than that, great site!

  26. I have to thank you for the efforts you have put in writing this website.

    I’m hoping to view the same high-grade content from you in the future as well.
    In truth, your creative writing abilities has inspired me to get
    my very own website now 😉

Comments are closed.