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 for … in.

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

  1. Hey! This is kind of off topic but I need some help from an established blog.
    Is it hard to set up your own blog? I’m not very techincal but I can figure things out pretty fast.
    I’m thinking about setting up my own but I’m not sure where to start.
    Do you have any points or suggestions? Appreciate it

  2. I’m curious to find out what blog platform you have been working with? I’m experiencing some small security problems with my latest blog and I’d like to find something more safe. Do you have any suggestions?|

  3. What’s Taking place i am new to this, I stumbled upon this I have found It
    positively helpful and it has aided me out loads. I am hoping to
    give a contribution & aid other users like its aided me.
    Great job.

  4. Hi! This is kind of off topic but I need some help from an established
    blog. Is it very hard to set up your own blog? I’m
    not very techincal but I can figure things out pretty fast.
    I’m thinking about setting up my own but I’m not sure where to begin. Do you
    have any points or suggestions? Cheers

  5. Excellent way of explaining, and nice paragraph to obtain facts on the topic of my presentation subject,
    which i am going to present in university.

  6. This piece of writing will assist the internet viewers for
    setting up new web site or even a weblog
    from start to end.

  7. What’s Happening i’m new to this, I stumbled upon this I have found It positively useful and it
    has aided me out loads. I am hoping to give a contribution & help different users
    like its helped me. Great job.

  8. This is very interesting, You are a very skilled blogger.
    I have joined your rss feed and look forward to seeking more of your wonderful post.

    Also, I’ve shared your web site in my social networks!

  9. The other day, while I was at work, my cousin stole my iphone and
    tested to see if it can survive a twenty five foot drop, just so she can be a youtube sensation. My iPad
    is now destroyed and she has 83 views. I know this is completely off topic but I had to share it with someone!

  10. I’m gone to convey my little brother, that he should also
    pay a visit this web site on regular basis to
    obtain updated from hottest reports.

  11. Having read this I believed it was extremely informative.
    I appreciate you taking the time and energy to put this article together.

    I once again find myself spending way too much
    time both reading and leaving comments. But so what, it was still worth it!

  12. I loved as much as you’ll receive carried out right here.

    The sketch is attractive, your authored material stylish.
    nonetheless, you command get bought an edginess over that you wish be delivering the following.
    unwell unquestionably come further formerly again as
    exactly the same nearly a lot often inside case you shield
    this increase.

  13. I appreciate, result in I discovered just what I was taking a look for.
    You’ve ended my 4 day lengthy hunt! God Bless you man. Have
    a great day. Bye

  14. Currently it seems like BlogEngine is the preferred blogging platform out there right now.
    (from what I’ve read) Is that what you’re using on your blog?

  15. Excellent blog right here! Additionally your web site quite a bit up very fast!
    What host are you the usage of? Can I get your associate link on your host?
    I wish my web site loaded up as fast as yours lol

  16. What’s Happening i am new to this, I stumbled upon this I have discovered It absolutely useful and it has helped me out loads.

    I hope to give a contribution & aid different customers like its aided me.
    Great job.

  17. Hello there! I could have sworn I’ve been to this site
    before but after reading through some of the post I realized it’s new to me.

    Anyways, I’m definitely glad I found it and I’ll be book-marking
    and checking back often!

  18. Currently it appears like Expression Engine is the top blogging platform out there right now.
    (from what I’ve read) Is that what you are using on your blog?

  19. With havin so much content do you ever run into any issues of plagorism or copyright infringement?
    My blog has a lot of exclusive content I’ve either created myself or outsourced but it appears a lot of it is popping
    it up all over the internet without my permission. Do you know any solutions to help protect against content
    from being ripped off? I’d truly appreciate it.

  20. What you published made a bunch of sense.
    But, think about this, suppose you typed a catchier title?
    I ain’t saying your content isn’t good., however suppose you added a title that grabbed a person’s attention? I
    mean Contoh Soal Pemrograman – Pola Segitiga Siku-siku – Umar faisol is a little plain. You should look at Yahoo’s home page
    and see how they create news titles to get people
    to open the links. You might add a video or a related
    pic or two to grab people excited about what you’ve got to say.
    Just my opinion, it would bring your posts a little livelier.

  21. Its like you read my mind! You seem to know so much about this, like you wrote the book in it or something.
    I think that you could do with a few pics to drive the message home a bit, but other than that,
    this is excellent blog. A fantastic read. I will certainly be back.

Comments are closed.