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,278 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

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

  2. Everything posted was actually very logical. However, think about this,
    suppose you were to write a killer headline? I ain’t suggesting your information isn’t
    solid, however what if you added a post title that grabbed people’s attention? I mean Contoh Soal
    Pemrograman – Pola Segitiga Siku-siku – Umar
    faisol is a little vanilla. You might glance at Yahoo’s home page and watch how they create article titles to get viewers
    to open the links. You might try adding a video or a related picture
    or two to grab people excited about what you’ve got to say.
    Just my opinion, it would make your website a
    little livelier.

  3. I’ll immеdiately clutch your rss as I can not to find your email subscription hyperlink oor e-newsletter seгvice.
    Do yоu’ve any? Plеase allow me understand so thazt I may just sᥙbscribе.
    Thanks.

  4. Generally I do not read post on blogs, but I wish to say that this
    write-up very pressured me to try and do so!
    Your writing style has been amazed me. Thanks, quite nice article.

  5. Hey There. I found your weblog using msn. That is a very well written article.
    I will be sure to bookmark it and return to learn extra of your useful information.
    Thank you for the post. I will certainly comeback.

  6. When I originally left a comment I seem to have clicked on the -Notify me when new comments are added- checkbox and from now
    on each time a comment is added I recieve four emails with
    the exact same comment. Is there an easy method you can remove me from that service?
    Appreciate it!

  7. Greetings! Very helpful advice within this post! It is the little changes that produce the most important changes.
    Thanks a lot for sharing!

  8. Great post. I was checking continuously this blog and I am impressed!
    Extremely useful info particularly the last part 🙂 I care for such information much.
    I was seeking this particular info for a long time.
    Thank you and good luck.

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

  10. Ⴝimply desire to saу your article is аs amazing. The clarity in your post is just еxcelⅼent and i can assume you’re an expert on this subject.

    Well with your ρermіssion allow me to grab your RSS
    feed to keep up to date with forthcoming post. Thanks a
    million and please carry on the rewardіng work.

  11. We are a group of volunteers and starting a new scheme in our community.
    Your site offered us with valuable info to work on. You’ve done a formidable job and
    our entire community will be thankful to you.

  12. Hi there just wanted to give you a quick 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 web browsers and both
    show the same outcome.

Comments are closed.