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. Write more, thats all I have to say. Literally, it seems as though you relied on the video
    to make your point. You obviously know what youre talking about,
    why throw away your intelligence on just posting videos to your site when you could be giving us something informative to read?

  2. Yesterday, while I was at work, my cousin stole my iPad and tested to see if it can survive a 30 foot drop, just so she can be
    a youtube sensation. My iPad is now broken and she has 83 views.

    I know this is totally off topic but I had to share
    it with someone!

  3. I just like the helpful information you provide for your
    articles. I’ll bookmark your weblog and take a look at again here frequently.
    I am slightly certain I’ll learn many new stuff proper right here!
    Good luck for the next!

  4. I’ve been browsing online more than three hours today, yet I never found any interesting article like yours.
    It is pretty worth enough for me. Personally, if all site owners and bloggers made
    good content as you did, the web will be a lot more useful than ever
    before.

  5. I’m curious to find out what blog platform you have been working with?
    I’m having some minor security issues with my latest
    site and I would like to find something more safe.
    Do you have any solutions?

  6. Today, while I was at work, my cousin stole my iPad and tested to see if it can survive a 40 foot drop, just
    so she can be a youtube sensation. My iPad is now broken and she has 83 views.
    I know this is completely off topic but I had to share
    it with someone!

  7. I’m curious to find out what blog system you happen to be working with?

    I’m having some minor security problems with my latest blog and
    I would like to find something more safeguarded.
    Do you have any recommendations?

  8. Everything published was actually very reasonable.
    But, what about this? what if you added a little information? I am
    not saying your content is not good., however suppose you added something
    to maybe get people’s attention? I mean Contoh Soal Pemrograman – Pola
    Segitiga Siku-siku – Umar faisol is a
    little plain. You should peek at Yahoo’s front page and see how they create news titles to grab viewers interested.
    You might add a related video or a related pic or
    two to grab readers interested about what you’ve written. Just my opinion, it would make
    your posts a little bit more interesting.

  9. Hello! I just wanted to ask if you ever have any trouble with
    hackers? My last blog (wordpress) was hacked and I ended up losing several weeks of hard work due to no data backup.
    Do you have any solutions to prevent hackers?

  10. Asking questions are truly pleasant thing if you are not understanding something fully,
    except this piece of writing provides pleasant understanding yet.

  11. I love what you guys tend to be up too. This kind of clever work and exposure!
    Keep up the fantastic works guys I’ve incorporated you guys to my blogroll.

  12. you are in reality a good webmaster. The web site loading speed is amazing.
    It kind of feels that you are doing any unique trick.

    Furthermore, The contents are masterwork. you’ve performed a fantastic job
    on this matter!

  13. We stumbled over here coming from a different page and thought I should check things
    out. I like what I see so now i am following you. Look forward to exploring your web page for a second time.

  14. Have you ever considered writing an ebook or guest authoring on other sites?
    I have a blog based upon on the same information you
    discuss and would love to have you share some stories/information. I know my subscribers would appreciate your work.
    If you’re even remotely interested, feel free
    to shoot me an e-mail.

  15. Hi there! I could have sworn I’ve been to this site before but after going through many
    of the posts I realized it’s new to me. Nonetheless, I’m certainly pleased I discovered it
    and I’ll be book-marking it and checking back often!

  16. I’m impressed, I must say. Rarely do I encounter a blog
    that’s equally educative and amusing, and let me tell you, you’ve hit the nail
    on the head. The issue is something too few people are speaking intelligently about.
    I’m very happy I found this during my hunt for something
    concerning this.

  17. Hi just wanted to give you a quick heads up and let you know a few of
    the pictures aren’t loading properly. I’m not sure why but I
    think its a linking issue. I’ve tried it in two different internet browsers
    and both show the same results.

  18. Hi! I could have sworn I’ve been to this blog before but after checking
    through some of the post I realized it’s new to me. Nonetheless, I’m definitely delighted I found
    it and I’ll be book-marking and checking back frequently!

Comments are closed.