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.

17,247 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. whoah this weblog is magnificent i like studying your posts.
    Stay up the great work! You understand, many individuals are searching around for this
    info, you can help them greatly.

  2. I take pleasure in, cause I discovered exactly what I
    was taking a look for. You’ve ended my four day long hunt!

    God Bless you man. Have a great day. Bye

  3. very interesting review. In addition visit all of our site to learn slot pulsa.
    Excellent internet site has received personality from the video slot gambling establishment participants in Dalam
    negeri. Right now there are actually quite a few fascinating
    promos when you join at this time.

  4. Good day! I could have sworn I’ve been to this site before but after browsing through many of
    the articles I realized it’s new to me. Anyways, I’m definitely delighted
    I found it and I’ll be bookmarking it and checking back often!

  5. It’s in fact very complex in this full of activity life to listen news on Television,
    therefore I only use the web for that purpose, and take the hottest information.

  6. Hmm is anyone else having problems with the images on this blog loading?
    I’m trying to figure out if its a problem on my end or if it’s the blog.

    Any suggestions would be greatly appreciated.

  7. Hmm is anyone else experiencing problems with the pictures on this blog loading?

    I’m trying to find out if its a problem on my end
    or if it’s the blog. Any feedback would be greatly appreciated.

  8. Hi there mates, how is the whole thing, and what you desire
    to say about this paragraph, in my view its truly remarkable in favor
    of me.

  9. Right here is the perfect site for anyone who wishes to find
    out about this topic. You realize a whole lot its almost hard
    to argue with you (not that I actually will need to…HaHa).
    You definitely put a brand new spin on a subject that’s been discussed for a
    long time. Wonderful stuff, just excellent!

  10. Its such as you read my thoughts! You seem to understand so much about this, such as you
    wrote the e book in it or something. I think that you simply could do
    with a few p.c. to drive the message house a bit,
    but instead of that, this is wonderful blog. An excellent
    read. I will certainly be back.

  11. I do not even understand how I stopped up right here,
    but I thought this put up was great. I don’t know who you are however definitely you’re
    going to a famous blogger when you aren’t already.
    Cheers!

  12. Hello! I’ve been reading your blog for some time now and finally got the bravery to go ahead and give
    you a shout out from New Caney Texas! Just wanted to mention keep up the fantastic job!

  13. Everyone loves what you guys tend to be up too.
    Such clever work and exposure! Keep up the fantastic works guys I’ve incorporated you guys to
    blogroll.

  14. necessary review. In addition visit this site to educate yourself judi slot
    online. All these pages has received conclusion from the situs slot
    online game playing challengers in Dalam negeri.
    There are actually plenty of eye-catching promos whenever you join at this time.

  15. Attractive section of content. I just stumbled upon your
    web site and in accession capital to assert that I acquire actually enjoyed account your
    blog posts. Any way I will be subscribing to your
    augment and even I achievement you access consistently
    fast.

  16. Hi 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 quicker then most. Can you recommend a good internet hosting provider at
    a fair price? Cheers, I appreciate it!

  17. Hi, i think that i saw you visited my blog thus i came to “return the favor”.I’m trying to find
    things to improve my web site!I suppose its ok to use some of your ideas!!

Comments are closed.