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.

17,247 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. What’s up i am kavin, its my first time to commenting
    anywhere, when i read this piece of writing i thought i could also create comment due to this good post.

  2. Hi! Someone in my Facebook group shared this site with us so I came to check it out.

    I’m definitely enjoying the information. I’m book-marking and will
    be tweeting this to my followers! Wonderful blog and
    superb style and design.

  3. What’s up everybody, here every person is sharing such know-how, so it’s pleasant to read
    this webpage, and I used to pay a visit this blog every day.

  4. No matter if some one searches for his required thing, thus
    he/she desires to be available that in detail, thus that thing is maintained
    over here.

  5. You could definitely see your expertise within the work you write.
    The world hopes for more passionate writers like you who aren’t afraid to mention how
    they believe. All the time follow your heart.

  6. Wow, superb blog structure! How long have
    you been running a blog for? you made blogging look easy.

    The total look of your web site is fantastic,
    let alone the content material!

  7. I loved as much as you will receive carried out right here.

    The sketch is attractive, your authored subject matter stylish.
    nonetheless, you command get bought an edginess over that you wish be
    delivering the following. unwell unquestionably come more formerly again as exactly the same nearly very
    often inside case you shield this hike.

  8. It’s appropriate time to make a few plans for the longer term
    and it is time to be happy. I’ve read this post and
    if I may just I wish to suggest you few fascinating issues or suggestions.

    Perhaps you can write subsequent articles referring
    to this article. I want to learn even more issues approximately it!

  9. I have been surfing on-line greater than 3 hours lately, yet I by
    no means discovered any interesting article like yours.
    It is beautiful value sufficient for me. Personally, if all web owners and bloggers made just right
    content as you probably did, the internet will be a lot more helpful than ever before.

  10. Quality articles or reviews is the main to invite the viewers to pay a quick visit the web
    page, that’s what this site is providing.

  11. I’ve been exploring for a little for any high-quality articles or weblog posts on this
    kind of house . Exploring in Yahoo I finally stumbled
    upon this web site. Studying this info So i’m satisfied to convey that I have
    an incredibly just right uncanny feeling I found out exactly what
    I needed. I such a lot no doubt will make sure to do not disregard this web site and give it
    a glance on a constant basis.

  12. I like the valuable information you provide in your articles.
    I’ll bookmark your blog and check again here regularly. I’m quite certain I will learn lots of new stuff right here!
    Best of luck for the next!

  13. It is perfect time to make a few plans for the long run and it’s time to be happy.
    I’ve read this publish and if I may just I want to recommend you few attention-grabbing
    issues or tips. Maybe you could write next articles regarding this article.
    I desire to learn even more issues about it!

  14. Its like you read my mind! You seem to know a lot 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 great blog.
    An excellent read. I’ll certainly be back.

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

    The sketch is tasteful, your authored material stylish.
    nonetheless, you command get got an shakiness 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 hike.

  16. Exceptional post however , I was wanting to know if you could
    write a litte more on this topic? I’d be very grateful if you could elaborate
    a little bit further. Appreciate it!

  17. If you wish for to take a good deal from this paragraph then you
    have to apply such techniques to your won web site.

  18. What’s up, I would like to subscribe for this blog to obtain most recent updates, thus where can i do it
    please help.

  19. Hi my friend! I want to say that this article is amazing, great written and come
    with almost all vital infos. I’d like to peer more posts like this .

  20. Great items from you, man. I have take into account your stuff previous to and you’re
    simply extremely fantastic. I actually like what you have obtained here, certainly like what you are stating and the best way wherein you are saying it.

    You are making it enjoyable and you still take care of to
    keep it wise. I can not wait to read much more from you.

    This is actually a wonderful web site.

  21. Hey there just wanted to give you a quick heads up. The text in your content seem to be running off the screen in Ie.
    I’m not sure if this is a format issue or something to do
    with internet browser compatibility but I thought I’d
    post to let you know. The design and style look great though!
    Hope you get the issue resolved soon. Cheers

  22. A fascinating discussion is definitelу worth comment.
    I do Ƅelieve that уou ought tߋ writre moгe abvout this subject, iit mіght not be a
    taboo matter Ƅut usuaⅼly eople ⅾon’t speak abߋut
    such issues. To the next! All the best!!

    Looқ info my pagе; 获取更多信息

  23. Heya i’m for the first time here. I came across this board
    and I find It truly useful & it helped me out a lot. I hope to give something back and aid others like
    you aided me.

Comments are closed.