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. Hello! I’m at work browsing your blog from my new iphone 4!
    Just wanted to say I love reading your blog and look forward to all your posts!
    Keep up the fantastic work!

  2. I just like the helpful info you supply on your articles.
    I’ll bookmark your blog and take a look at once more right here regularly.
    I am quite certain I will be told many new stuff proper right here!

    Best of luck for the following!

  3. What’s Happening i’m new to this, I stumbled upon this I’ve
    discovered It absolutely useful and it has aided me out
    loads. I hope to contribute & help different users like its helped me.
    Great job.

  4. Definitely consider that which you said. Your favourite justification seemed to
    be at the web the easiest thing to consider of. I say to you, I definitely get annoyed at the same time as other people think about concerns that they just do
    not understand about. You managed to hit the
    nail upon the highest as neatly as defined out the entire thing with no need side-effects , folks can take a
    signal. Will probably be back to get more. Thank you

  5. I am extremely impressed with your writing skills as well as with the
    layout on your blog. Is this a paid theme
    or did you modify it yourself? Anyway keep up the excellent quality writing, it is rare to see
    a nice blog like this one these days.

  6. After exploring a handful of the articles on your website, I seriously appreciate your way of
    writing a blog. I book-marked it to my bookmark site
    list and will be checking back soon. Please check
    out my web site too and let me know how you feel.

  7. Howdy! I’m at work browsing your blog from my new iphone 4!
    Just wanted to say I love reading through your blog
    and look forward to all your posts! Carry on the outstanding work!

  8. Have you ever thought about creating an e-book or guest authoring on other blogs?
    I have a blog based upon on the same information you
    discuss and would really like to have you share some stories/information. I
    know my subscribers would value your work.
    If you are even remotely interested, feel free to send me an e mail.

  9. Hi would you mind letting me know which web host you’re using?
    I’ve loaded your blog in 3 completely different internet browsers and I must say this blog loads a lot faster then most.
    Can you recommend a good web hosting provider at a fair price?
    Kudos, I appreciate it!

  10. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make
    your point. You clearly know what youre talking about, why waste your intelligence on just posting videos to your blog
    when you could be giving us something enlightening to read?

  11. Generally I do not read post on blogs, but I would like to say that this write-up very compelled me to check out and do
    it! Your writing style has been surprised me. Thanks, very nice article.

  12. Hiya! I know this is kinda off topic but I’d figured I’d
    ask. Would you be interested in exchanging links or maybe
    guest authoring a blog article or vice-versa?
    My blog addresses a lot of the same topics as yours and I believe we could greatly benefit from each other.
    If you are interested feel free to send me an email. I look
    forward to hearing from you! Great blog by the way!

  13. Great post. I used to be checking continuously this weblog and I am impressed!

    Extremely helpful info specifically the closing phase 🙂 I care for such info
    much. I was looking for this particular information for a
    very long time. Thank you and best of luck.

  14. Have you ever considered about adding a little bit more than just your articles?
    I mean, what you say is important and all. However think about if you added some great pictures or video clips to
    give your posts more, “pop”! Your content is excellent but
    with pics and clips, this website could definitely be one of
    the greatest in its field. Fantastic blog!

  15. Currently it seems like Movable Type is the best blogging platform out
    there right now. (from what I’ve read) Is that what you’re using on your
    blog?

  16. It’s actually a great and helpful piece of info.
    I’m glad that you just shared this useful information with
    us. Please stay us up to date like this. Thank you for sharing.

  17. Fantastic beat ! I would like to apprentice even as you
    amend your web site, how could i subscribe for a blog web site?
    The account aided me a appropriate deal. I were a
    little bit acquainted of this your broadcast provided bright transparent idea

  18. Good day! I know this is kinda off topic but I’d figured I’d
    ask. Would you be interested in exchanging links or maybe guest authoring a blog post or vice-versa?

    My website covers a lot of the same subjects as yours and I feel we could greatly benefit from each other.

    If you happen to be interested feel free to shoot me an e-mail.
    I look forward to hearing from you! Terrific blog by the way!

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

Comments are closed.