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

  1. It is the best time to make some plans for the future and it is time to
    be happy. I’ve read this post and if I could I desire to
    suggest you some interesting things or advice.
    Perhaps you can write next articles referring to this article.
    I desire to read even more things about it!

  2. I have to thank you for the efforts you have put in writing this blog.
    I really hope to see the same high-grade content from you later on as well.
    In truth, your creative writing abilities has encouraged me to get my own, personal site now 😉

  3. I am sure this piece of writing has touched all
    the internet users, its really really fastidious piece of
    writing on building up new webpage.

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

  5. I am sure this post has touched all the internet visitors, its really really fastidious post on building
    up new website.

  6. It is the best time to make some plans for the future and
    it is time to be happy. I’ve read this post and if I could I desire to suggest you some
    interesting things or suggestions. Maybe you can write next articles referring to this article.
    I want to read even more things about it!

  7. You could definitely see your enthusiasm within the work you write.
    The sector hopes for even more passionate writers such as you who aren’t afraid to
    say how they believe. At all times go after your heart.

  8. I am really impressed with your writing skills and also
    with the layout on your blog. Is that this a paid subject matter or did you customize it yourself?

    Anyway stay up the excellent high quality writing,
    it’s rare to see a great blog like this one today..

  9. you are in reality a good webmaster. The site loading pace is incredible.
    It seems that you’re doing any distinctive trick.
    Also, The contents are masterwork. you’ve performed a fantastic activity on this topic!

  10. It is the best time to make a few plans for the future and it is time to
    be happy. I have learn this publish and if I may I want to counsel you few interesting things or
    advice. Maybe you could write next articles regarding this article.
    I wish to learn even more things approximately it!

  11. Greetings! 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 iphone4.
    I’m trying to find a template or plugin that might be able to correct this issue.
    If you have any suggestions, please share. Thanks!

  12. I see your page needs some fresh articles.

    Writing manually is time consuming, but there is solution for this.

    Just search for: Masquro’s strategies

Comments are closed.