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 don’t even know how I ended up here, but I thought this post was great.
    I do not know who you are but definitely you’re going to a famous blogger if you aren’t already 😉 Cheers!

  2. Wonderful beat ! I wish to apprentice at the same time
    as you amend your site, how can i subscribe for a weblog web site?
    The account aided me a applicable deal. I have been tiny bit acquainted of this your broadcast offered bright transparent concept

  3. I’m not that much of a internet reader to be honest but your sites really nice, keep it up!
    I’ll go ahead and bookmark your site to come back later.
    All the best

  4. I am now not sure where you’re getting your info, but great topic.
    I needs to spend a while studying more or understanding more.
    Thanks for excellent info I used to be in search of this information for my mission.

  5. Someone necessarily lend a hand to make severely articles I might state.
    That is the very first time I frequented your web
    page and up to now? I surprised with the analysis
    you made to make this particular publish extraordinary.
    Magnificent task!

  6. I’m extremely impressed with your writing skills as well as with
    the layout on your weblog. Is this a paid theme or did
    you customize it yourself? Either way keep up the excellent quality writing, it
    is rare to see a great blog like this one these days.

  7. Hi i am kavin, its my first occasion to commenting anyplace, when i read this paragraph i thought i could also make comment due to this sensible
    paragraph.

  8. Thanks for finally writing about > Contoh Soal Pemrograman – Pola Segitiga Siku-siku – Umar faisol < Loved it!

  9. You’re so interesting! I don’t think I’ve truly read
    something like that before. So great to find another person with a few unique thoughts on this issue.
    Seriously.. many thanks for starting this up. This website is something
    that is required on the internet, someone with some originality!

  10. Howdy! Do you know if they make any plugins to assist with Search
    Engine Optimization? I’m trying to get my blog to rank for some targeted
    keywords but I’m not seeing very good results. If you know of any please share.
    Appreciate it!

  11. It’s 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 want to suggest you some
    interesting things or advice. Maybe you could write
    next articles referring to this article. I wish to read more things about it!

  12. Today, I went to the beach front with my kids.
    I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.”
    She placed the shell to her ear and screamed. There was a hermit crab inside and it pinched her
    ear. She never wants to go back! LoL I know this is entirely off topic but I had to
    tell someone!

  13. I am really loving the theme/design of your website.

    Do you ever run into any web browser compatibility issues?
    A couple of my blog readers have complained about my
    blog not working correctly in Explorer but looks great in Chrome.
    Do you have any advice to help fix this issue?

Comments are closed.