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 for … in.

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.

16,626 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku”

  1. I’m gone to say to my little brother, that he should also pay a
    visit this web site on regular basis to get updated from newest
    gossip.

  2. Ahaa, its fastidious discussion concerning this piece
    of writing here at this web site, I have read all that, so
    at this time me also commenting here.

  3. I have been browsing online more than 2 hours today, yet I never found any interesting
    article like yours. It’s pretty worth enough for me. Personally, if all web owners and bloggers made good content as you did,
    the internet will be much more useful than ever before.

  4. I got this site from my friend who shared with me regarding
    this web page and now this time I am browsing this web site and reading very informative content at
    this place.

  5. Link exchange is nothing else however it is simply placing the other
    person’s blog link on your page at proper place and other person will also do same in favor of you.

  6. Great beat ! I would like to apprentice while you amend your web site,
    how could i subscribe for a blog site? The account helped me a acceptable deal.
    I had been tiny bit acquainted of this your broadcast offered bright clear concept

  7. Good day! Do you use Twitter? I’d like to follow you if that would be ok.
    I’m definitely enjoying your blog and look forward
    to new updates.

  8. What i do not understood is if truth be told how you are no longer actually much more neatly-appreciated than you may be right now.
    You are so intelligent. You know thus significantly relating to this matter,
    made me for my part consider it from a lot of numerous angles.
    Its like women and men aren’t interested unless it
    is one thing to accomplish with Woman gaga!
    Your individual stuffs great. At all times care for it up!

  9. Everyone loves what you guys are usually up too. This type of clever work and coverage!

    Keep up the wonderful works guys I’ve incorporated
    you guys to my own blogroll.

  10. I’m amazed, I must say. Rarely do I encounter a blog that’s both equally educative and interesting, and without a doubt,
    you have hit the nail on the head. The issue is something not enough people are speaking
    intelligently about. I am very happy I came across this in my search for something
    regarding this.

  11. Attractive element of content. I just stumbled upon your web site and in accession capital to assert
    that I get actually enjoyed account your blog posts. Any way I will be
    subscribing to your augment and even I success you get entry
    to persistently fast.

  12. I have been exploring for a bit for any high quality articles or weblog posts in this
    kind of space . Exploring in Yahoo I at last stumbled upon this site.
    Reading this info So i’m glad to exhibit that I have
    a very excellent uncanny feeling I found out exactly what I needed.
    I most without a doubt will make certain to do not omit this web site and
    give it a glance regularly.

  13. I read this paragraph fully on the topic of the difference of newest and preceding technologies,
    it’s remarkable article.

Comments are closed.