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. Hi this is somewhat of off topic but I was wondering if blogs use WYSIWYG
    editors or if you have to manually code with HTML.
    I’m starting a blog soon but have no coding know-how so I wanted to get
    advice from someone with experience. Any help would be enormously appreciated!

  2. It’s appropriate time to make some plans for the
    future and it’s time to be happy. I’ve read this
    post and if I could I want to suggest you few interesting things or tips.
    Maybe you could write next articles referring to this article.
    I want to read more things about it!

  3. Woah! I’m really digging the template/theme
    of this website. It’s simple, yet effective.
    A lot of times it’s very hard to get that “perfect balance” between usability and
    appearance. I must say that you’ve done a superb job with this.
    Additionally, the blog loads extremely quick for me on Safari.
    Exceptional Blog!

  4. 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 blog when you could
    be giving us something informative to read?

  5. Aw, this was an incredibly nice post. Finding the time and actual effort to create a top notch article… but what can I say… I put things off a whole lot and never
    manage to get nearly anything done.

  6. I know this if off topic but I’m looking into starting my own weblog and was
    curious what all is needed to get setup? I’m
    assuming having a blog like yours would cost a
    pretty penny? I’m not very web smart so I’m
    not 100% sure. Any recommendations or advice would
    be greatly appreciated. Cheers

  7. Hi to every single one, it’s actually a good
    for me to visit this web site, it consists of valuable Information.

  8. I was suggested this web site by way of my cousin. I’m no longer positive whether
    this put up is written via him as no one else know such designated approximately my problem.
    You are wonderful! Thank you!

  9. I don’t even know how I ended up here, but I thought this post was great.
    I don’t know who you are but definitely you are going to a famous blogger if you are not already
    😉 Cheers!

  10. Good post. I learn something new and challenging on blogs I stumbleupon every day.
    It’s always helpful to read through articles
    from other writers and practice something from their websites.

  11. I’m very happy to find this page. I wanted to thank you for your time just for this fantastic read!!
    I definitely loved every part of it and i also have you book marked to check out new stuff
    on your site.

  12. Hmm it seems like your site ate my first comment (it
    was super long) so I guess I’ll just sum it up what I wrote and say, I’m thoroughly enjoying your blog.
    I too am an aspiring blog blogger but I’m still new to everything.
    Do you have any recommendations for newbie blog writers? I’d
    definitely appreciate it.

  13. Good day! I know this is kinda off topic but I’d figured I’d ask.
    Would you be interested in exchanging links or maybe guest
    writing a blog post or vice-versa? My blog goes over a lot of the same topics as yours and I think we could greatly benefit from each other.
    If you’re interested feel free to shoot me an e-mail. I look forward to
    hearing from you! Superb blog by the way!

  14. obviously like your website however you have to take a look at the spelling
    on quite a few of your posts. Many of them are rife with spelling problems and I find it very troublesome to tell the truth then again I will surely come
    back again.

  15. hey there and thank you for your info – I have definitely picked up anything new from right here.
    I did however expertise a few technical issues using this website, since I experienced to reload
    the website a lot of times previous to I could get it to load correctly.
    I had been wondering if your web host is OK?
    Not that I am complaining, but sluggish loading instances times will often affect your placement
    in google and can damage your high quality score
    if ads and marketing with Adwords. Well I’m adding this RSS to my e-mail and can look out for a
    lot more of your respective exciting content. Ensure that you update this again soon.

  16. I’m curious to find out what blog system
    you are utilizing? I’m having some minor security problems with my latest website and
    I’d like to find something more secure. Do you have any recommendations?

  17. Hi there are using WordPress for your site platform? I’m new
    to the blog world but I’m trying to get started and create my own. Do
    you need any html coding knowledge to make your own blog?
    Any help would be really appreciated!

  18. whoah this weblog is fantastic i really like studying your articles.
    Keep up the good work! You recognize, a lot
    of persons are looking round for this info, you can aid them
    greatly.

  19. Just wish to say your article is as surprising.
    The clearness to your post is just excellent and that
    i could suppose you’re a professional on this subject.
    Fine together with your permission let me to clutch your
    feed to keep up to date with forthcoming post. Thanks a
    million and please continue the rewarding work.

  20. Its like you read my thoughts! You appear to understand so much about this, like you wrote the e book in it or something.
    I believe that you simply can do with some percent to drive the message home
    a bit, but other than that, that is fantastic blog. A great read.

    I will definitely be back.

  21. Hi! Quick question that’s completely off topic.
    Do you know how to make your site mobile friendly?
    My blog looks weird when browsing from my iphone4. I’m trying to find
    a theme or plugin that might be able to resolve this issue.
    If you have any suggestions, please share.
    Thank you!

Comments are closed.