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

  1. I’ll immediately seize your rss as I can not to find
    your e-mail subscription hyperlink or newsletter service.
    Do you’ve any? Please allow me know so that I
    may just subscribe. Thanks.

  2. Hey just wanted to give you a brief heads up and let you know a few of the images aren’t loading correctly.
    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.

  3. Very great post. I simply stumbled upon your weblog and wanted to mention that I’ve really loved surfing around your weblog
    posts. In any case I’ll be subscribing to your rss feed and I am hoping you write once more soon!

  4. Today, I went to the beachfront 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 completely off topic but I had to tell someone!

  5. This is the perfect site for anybody who hopes to
    find out about this topic. You understand so much its almost tough to argue with you (not that I actually
    would want to…HaHa). You certainly put a fresh spin on a subject that has been written about for decades.
    Excellent stuff, just excellent!

  6. Today, I went to the beach 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!

  7. Good site you’ve got here.. It’s hard to find high-quality writing like
    yours these days. I really appreciate individuals like you!

    Take care!!

  8. 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 me from that service? Thank you!

  9. An impressive share! I have just forwarded this onto a colleague who was
    conducting a little research on this. And he actually ordered me
    lunch simply because I stumbled upon it
    for him… lol. So allow me to reword this…. Thanks
    for the meal!! But yeah, thanks for spending time to discuss this topic here on your website.

  10. I think this is among the most significant information for
    me. And i am glad studying your article. However should statement
    on some basic things, The site taste is wonderful, the articles is actually excellent : D.
    Just right task, cheers

  11. It’s appropriate time to make some plans for the
    longer term and it’s time to be happy. I have
    read this submit and if I may I wish to suggest you few interesting
    things or advice. Maybe you can write next articles regarding this article.
    I want to read even more issues about it!

  12. Oh my goodness! Impressive article dude! Many thanks, However I am having issues with your RSS.
    I don’t know the reason why I cannot join it. Is there anybody getting the same RSS problems?
    Anyone that knows the answer will you kindly respond? Thanx!!

  13. Great article! That is the type of info that are supposed
    to be shared across the internet. Shame on Google for not
    positioning this post higher! Come on over and visit my web site .

    Thank you =)

  14. I always used to study paragraph in news papers but now as I am
    a user of net so from now I am using net for articles or
    reviews, thanks to web.

  15. I’m impressed, I must say. Seldom do I encounter a blog that’s equally educative and interesting, and let me tell you, you have hit the nail on the head. The issue is something which not enough people are speaking intelligently about. I am very happy that I found this in my hunt for something relating to this.|

  16. I have to thank you for the efforts you’ve put in penning
    this site. I am hoping to see the same high-grade blog
    posts by you later on as well. In truth, your creative writing abilities has inspired me to get my own, personal
    website now 😉

  17. Hi, Neat post. There is a problem along with your website in web explorer, would test this?
    IE still is the market leader and a good part of people will leave out your fantastic writing because of this problem.

  18. 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 waste your
    intelligence on just posting videos to your weblog when you could be giving us something
    informative to read?

  19. Hi, the whole thing is going sound here and ofcourse every one is sharing facts, that’s
    truly excellent, keep up writing.

  20. I read this piece of writing completely regarding the comparison of most up-to-date
    and preceding technologies, it’s remarkable article.

  21. Hi! I simply would like to offer you a huge thumbs up for
    the excellent info you’ve got right here on this post.

    I will be returning to your web site for more soon.

  22. Write more, thats all I have to say. Literally, it seems as though you relied
    on the video to make your point. You clearly know what youre talking about,
    why waste your intelligence on just posting videos to your blog when you could
    be giving us something enlightening to read?

  23. Heya i’m for the first time here. I came across this board
    and I in finding It truly useful & it helped me out much.
    I’m hoping to present one thing back and help others such as you helped me.

Comments are closed.