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. Having read this I thought it was really informative. I appreciate you finding the time and
    energy to put this information together. I once again find myself personally spending way too much time both
    reading and leaving comments. But so what, it was still worth
    it!

  2. Aw, this was a really good post. Finding the time and actual effort to make a superb article… but what can I say… I hesitate
    a whole lot and never manage to get nearly anything done.

  3. Appreciating the commitment you put into your site and detailed information you
    present. It’s nice to come across a blog every once in a
    while that isn’t the same out of date rehashed material.
    Wonderful read! I’ve bookmarked your site and I’m adding your RSS feeds to
    my Google account.

  4. Hello, Neat post. There is an issue along with your site in web explorer, may test this?

    IE nonetheless is the market leader and a large part of people will omit your magnificent writing due
    to this problem.

  5. Wow that was strange. I just wrote an extremely long comment but after I clicked submit my
    comment didn’t show up. Grrrr… well I’m not writing all that
    over again. Anyways, just wanted to say excellent blog!

  6. I’m really loving the theme/design of your website.

    Do you ever run into any browser compatibility problems?
    A small number of my blog visitors have complained about my blog not working correctly in Explorer but
    looks great in Opera. Do you have any advice to help fix this problem?

  7. I really like what you guys tend to be up too. Such clever
    work and coverage! Keep up the wonderful works guys I’ve incorporated you guys to our blogroll.

  8. You really make it seem so easy together with your presentation but I
    to find this topic to be really something which I feel I’d never
    understand. It kind of feels too complex and extremely vast for me.
    I am taking a look ahead in your subsequent post,
    I will try to get the dangle of it!

  9. I was suggested this blog by my cousin. I am not sure whether this
    post is written by him as no one else know such detailed about my difficulty.
    You are wonderful! Thanks!

  10. My brother suggested I would possibly like this blog. He was once totally right.

    This post truly made my day. You can not consider simply how much time I had spent for this info!
    Thank you!

  11. Generally I do not read post on blogs, but I wish to say that
    this write-up very compelled me to try and do so!
    Your writing style has been surprised me. Thank you, very nice article.

  12. I was recommended this blog through my cousin. I am no longer sure whether or
    not this submit is written through him as nobody else realize such certain about my problem.
    You’re wonderful! Thank you!

  13. Hello there, I think your site may be having internet browser compatibility problems.

    Whenever I take a look at your web site in Safari, it looks fine but when opening in Internet Explorer, it has some overlapping issues.
    I simply wanted to give you a quick heads up! Aside from that, great blog!

  14. Greetings! Very helpful advice in this particular post!

    It’s the little changes that produce the biggest changes.
    Thanks for sharing!

  15. This design is spectacular! You certainly know how to keep a reader entertained.

    Between your wit and your videos, I was almost moved to start my
    own blog (well, almost…HaHa!) Wonderful job. I really loved what
    you had to say, and more than that, how you presented it. Too cool!

  16. Having read this I believed it was really informative. I appreciate you taking the time and effort to
    put this short article together. I once again find myself personally spending way
    too much time both reading and commenting. But so what, it was still worthwhile!

  17. You made some really good points there. I checked
    on the net to learn more about the issue and found most individuals will
    go along with your views on this site.

  18. Hi there to all, the contents existing at this web site are really amazing for people
    experience, well, keep up the nice work fellows.

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

Comments are closed.