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

  1. Howdy! This is my first visit to your blog!
    We are a group of volunteers and starting a new project in a community in the same
    niche. Your blog provided us useful information to work
    on. You have done a outstanding job!

  2. Thanks for ones marvelous posting! I quite enjoyed reading it, you could be a great author.I will make certain to bookmark your blog and will come back sometime soon. I want to
    encourage you continue your great posts, have a nice
    morning!

  3. Undeniably consider that that you said. Your
    favorite reason appeared to be on the web
    the simplest factor to remember of. I say to you, I certainly
    get irked at the same time as people consider concerns that they plainly do not recognize about.

    You controlled to hit the nail upon the highest and defined out the whole thing without having side effect , other folks can take a
    signal. Will probably be again to get more.

    Thanks

  4. Sweet blog! I found it while searching on Yahoo News. Do you have any tips on how to get listed in Yahoo News?
    I’ve been trying for a while but I never seem to get there!
    Thanks

  5. When some one searches for his necessary thing, therefore
    he/she wants to be available that in detail, therefore that thing is maintained over
    here.

  6. I’m also writing to let you be aware of what a cool experience my child experienced viewing the
    blog. She picked up such a lot of issues, with the inclusion of how it is like to possess an awesome teaching nature to get many people with no
    trouble know selected very confusing matters. You undoubtedly surpassed
    her expectations. I appreciate you for providing the good, trustworthy,
    educational as well as cool tips about the topic to Jane.

    my website :: bathroom wall cabinets uk only

  7. When I originally commented I seem 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.
    Is there a means you are able to remove me from that service?
    Cheers!

  8. I am not sure where you are getting your information, but great topic.
    I needs to spend some time learning much more or understanding more.
    Thanks for excellent info I was looking for
    this information for my mission.

  9. Thanks a lot for sharing this with all folks you actually knkw whawt you’re talking about!

    Bookmarked. Please additionally discuss with my
    web sige =). We may have a link alternate
    arrangement between us
    wirtualne casino web page internetowe gry hazardowe

  10. Pretty great post. I simply stumbled upon your blog and
    wished to say that I’ve really enjoyed surfing around your blog posts.
    After all I’ll be subscribing on your feed and I’m hoping you write once more soon!

Comments are closed.