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.

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

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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!

  6. 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.

  7. 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!

  8. 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.

  9. 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.

  10. 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.

  11. 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!

  12. When I initially commented I clicked the “Notify me when new comments are added” checkbox and
    now each time a comment is added I get four emails with the same comment.
    Is there any way you can remove people from that service?
    Bless you!

  13. Howdy just wanted to give you a quick heads up. The words in your article
    seem to be running off the screen in Ie. I’m not sure if this
    is a format issue or something to do with browser compatibility
    but I figured I’d post to let you know. The design and style look great though!
    Hope you get the problem solved soon. Cheers

  14. I have been surfing online more than 3 hours these days,
    yet I by no means found any attention-grabbing article like yours.
    It is lovely price enough for me. In my opinion, if all web owners and bloggers made excellent content material as you probably
    did, the net might be much more helpful than ever before.

  15. Heya! I just wanted to ask if you ever have any issues with
    hackers? My last blog (wordpress) was hacked and I ended up losing many months of hard work due
    to no data backup. Do you have any methods to stop hackers?

  16. Attractive section of content. I just stumbled upon your web site and
    in accession capital to assert that I acquire in fact enjoyed account your blog posts.

    Anyway I’ll be subscribing to your feeds and even I achievement you access consistently quickly.

Comments are closed.