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.

399 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. [url=http://viagraoctab.com/]buy sildenafil 25 mg[/url] [url=http://viagradx.com/]how can i get viagra prescription[/url] [url=http://cialisfd.com/]generic cialis uk pharmacy[/url] [url=http://iviagracialislevitra.com/]sildenafil citrate buy[/url] [url=http://viagrapoint.com/]sildenafil 100 mg best price[/url] [url=http://viagraops.com/]how to buy real viagra[/url]

  2. It is perfect time to make some plans for the future and it
    is time to be happy. I have read this post and
    if I could I wish to suggest you some interesting things or advice.
    Perhaps you could write next articles referring to this article.
    I want to read more things about it!

  3. Ahaa, its good conversation concerning this paragraph at this place at this webpage, I have read all that, so now me also commenting at
    this place.

  4. Itts uch aas yyou learn mmy thoughts! Yoou serm to know a lott
    about this, likle yoou wrote the guide iin itt orr something.

    I think thast you just caan ddo wiyh some p.c. tto drrive the mesage hom
    a littke bit, but instead of that, thijs iss fantastic blog.

    An exxcellent read. I wiill certainly bbe back.

  5. Do you have a spam issue on this site; I also am a blogger,
    and I was curious about your situation; many of us have developed some nice methods and we are looking to exchange solutions
    with other folks, be sure to shoot me an email if interested.

  6. It’s appropriate time to make a few plans for the long run and it is time to be
    happy. I’ve read this post and if I may just
    I want to suggest you some attention-grabbing things or advice.
    Perhaps you could write subsequent articles relating to this article.
    I want to read more issues about it!

  7. I’ll right away snatch your rss as I can’t in finding your e-mail subscription link or newsletter service.
    Do you have any? Please allow me realize in order that I may just subscribe.
    Thanks.

  8. It is appropriate time to make some plans for the long run and it is time to be happy.
    I’ve learn this publish and if I may I desire
    to recommend you some attention-grabbing things or suggestions.
    Perhaps you can write subsequent articles regarding this article.
    I wish to read even more things approximately it!

  9. Hey there would you mind letting me know which
    webhost you’re working with? I’ve loaded your blog in 3
    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 reasonable price?
    Thanks a lot, I appreciate it!

  10. It is perfect time to make some plans for
    the future and it’s time to be happy. I have read this post and if I could I desire to suggest
    you some interesting things or tips. Maybe you could write next articles referring
    to this article. I want to read more things about it!

  11. Its like you learn my mind! You appear to know so much about
    this, like you wrote the ebook in it or something. I feel that you could do with some p.c.
    to power the message house a little bit, however other than that, that is fantastic blog.

    A fantastic read. I’ll certainly be back.

  12. It is appropriate time to make some plans for the future and it’s
    time to be happy. I have read this post and if I
    could I want to suggest you few interesting things
    or suggestions. Maybe you could write next articles referring to this article.

    I wish to read even more things about it!

  13. Hi my family member! I wish to say that this article is amazing, nice written and include almost all important infos. I’d like to peer extra posts like this.

  14. I’ll right away snatch your rss as I can not to
    find your email subscription link or newsletter service.
    Do you have any? Please let me know in order that I may subscribe.
    Thanks.

  15. It is appropriate time to make some plans for the future and
    it’s time to be happy. I have read this post and if I could I desire to
    suggest you few interesting things or suggestions. Perhaps you can write next articles referring to this article.
    I wish to read even more things about it!

  16. Hi! I’ve been following your weblog for a while now
    and finally got the bravery to go ahead and give you
    a shout out from Atascocita Texas! Just wanted to tell you keep up the great work!

Leave a Reply

Your email address will not be published. Required fields are marked *