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

  1. I have to thank you for the efforts you’ve
    put in writing this site. I really hope to view the same high-grade content by you in the future as
    well. In fact, your creative writing abilities has motivated
    me to get my own, personal website now 😉

  2. A motivating discussion is definitely worth comment.
    I do believe that you should publish more on this issue, it might
    not be a taboo subject but generally people don’t speak about
    such subjects. To the next! Best wishes!!

  3. What’s up everyone, it’s my first go to see at this website, and post is
    really fruitful designed for me, keep up posting these posts.

  4. Spot on with this write-up, I actually believe that this web site needs a great deal more attention. I’ll probably be
    returning to read through more, thanks for the advice!

  5. Nice post. I used to be checking continuously
    this blog and I am impressed! Extremely useful information specifically the ultimate
    part 🙂 I care for such info a lot. I used to be looking for this particular information for a long time.
    Thank you and good luck.

  6. I know this if off topic but I’m looking into starting my own weblog
    and was curious what all is required to get set up?
    I’m assuming having a blog like yours would cost a pretty penny?
    I’m not very internet smart so I’m not 100% certain. Any recommendations or advice would be
    greatly appreciated. Thank you

  7. I just like the valuable information you provide on your articles.
    I’ll bookmark your blog and take a look at once more here regularly.
    I’m somewhat sure I’ll be informed many new stuff
    right right here! Good luck for the following!

  8. Nice post. I learn something new and challenging on websites I stumbleupon on a daily basis.
    It’s always interesting to read articles from other writers and use a little something from
    other web sites.

  9. We are a group of volunteers and opening a new scheme in our community.

    Your web site provided us with valuable info to work on. You have done a formidable job
    and our entire community will be thankful to you.

  10. чемпион казино онлайн официальный

    Официальный сайт оформлен со вкусом и лаконичен. Его главная страница содержит баннеры для текущих акций, новости азартных игр, а также размер джекпотов, разыгрываемых в настоящее время в определенных игровых автоматах

  11. Every weekend i used to go to see this site, as i want
    enjoyment, as this this web page conations truly pleasant funny information too.

  12. whoah this blog is magnificent i love studying your articles.
    Stay up the good work! You realize, lots of individuals are looking around for this info,
    you could help them greatly.

Comments are closed.