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. That is very interesting, You are an overly skilled blogger.
    I have joined your rss feed and sit up for searching for more of your great
    post. Additionally, I’ve shared your site in my social networks

  2. I was curious if you ever considered changing the layout of
    your site? Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of content so
    people could connect with it better. Youve got an awful lot of text for only having one or two
    pictures. Maybe you could space it out better?

  3. Hmm it looks like your blog 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 the whole thing.
    Do you have any recommendations for beginner blog writers?
    I’d definitely appreciate it.

  4. Every weekend i used to pay a visit this web site, as i wish for enjoyment,
    since this this website conations genuinely fastidious funny data
    too.

  5. Howdy! I know this is somewhat off topic but I
    was wondering which blog platform are you using for this site?

    I’m getting tired of WordPress because I’ve had problems
    with hackers and I’m looking at alternatives for another platform.
    I would be awesome if you could point me in the direction of a good
    platform.

  6. I have been browsing online more than three hours today, yet I never found
    any interesting article like yours. It is pretty worth enough for me.

    Personally, if all website owners and bloggers made good content as you did, the internet will
    be much more useful than ever before.

  7. Hi there would you mind sharing which blog platform you’re using?

    I’m planning to start my own blog soon but I’m having a tough time selecting between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your layout seems
    different then most blogs and I’m looking for something unique.
    P.S My apologies for getting off-topic but I had to ask!

  8. Hello, everything is going fine here and ofcourse every one is sharing information, that’s actually fine, keep up writing.

  9. Hey I know this is off topic but I was wondering if you knew of any widgets I could
    add to my blog that automatically tweet my newest twitter updates.

    I’ve been looking for a plug-in like this for
    quite some time and was hoping maybe you would have some
    experience with something like this. Please let me know if you run into anything.
    I truly enjoy reading your blog and I look forward to your new updates.

  10. Howdy! I know this is kinda off topic nevertheless I’d figured I’d ask.
    Would you be interested in trading links or maybe guest writing a
    blog post or vice-versa? My blog covers a lot
    of the same topics as yours and I believe we could greatly benefit from
    each other. If you are interested feel free to send me an email.
    I look forward to hearing from you! Great blog by the way!

  11. I like the helpful information you provide in your articles.
    I will bookmark your weblog and check again here frequently.
    I’m quite sure I’ll learn many new stuff right here! Good luck for the next!

  12. Woah! I’m really enjoying the template/theme of this blog.
    It’s simple, yet effective. A lot of times it’s tough to get that
    “perfect balance” between usability and visual appearance.
    I must say that you’ve done a fantastic job with this.
    Additionally, the blog loads extremely fast for
    me on Internet explorer. Excellent Blog!

  13. Hi there! I know this is kinda off topic but I’d figured I’d ask.
    Would you be interested in trading links or maybe guest authoring a blog article or
    vice-versa? My website addresses a lot of the same topics as yours and I think we could greatly
    benefit from each other. If you might be interested feel free to shoot me an e-mail.
    I look forward to hearing from you! Fantastic blog by the way!

  14. Do you mind if I quote a couple of your articles as long as I
    provide credit and sources back to your weblog?
    My blog is in the very same area of interest as yours and my users would
    genuinely benefit from some of the information you
    present here. Please let me know if this ok with you.
    Regards!

  15. Fantastic goods from you, man. I have understand your stuff previous to and you
    are just too fantastic. I really like what you’ve acquired here,
    certainly like what you are stating and the way in which you say
    it. You make it entertaining and you still care for to keep it sensible.
    I cant wait to read much more from you. This is really a great site.

  16. Hi there! Do you use Twitter? I’d like to follow you if that would be ok.
    I’m definitely enjoying your blog and look forward to new posts.

  17. My spouse and I stumbled over here by a different web address and thought I might
    as well check things out. I like what I see so now i’m
    following you. Look forward to finding out about your web page repeatedly.

    Take a look at my web page – travel coffee

  18. When someone writes an article he/she keeps the thought of a user in his/her mind that how a user can understand it.
    Therefore that’s why this paragraph is outstdanding. Thanks!

  19. Have you ever thought about adding a little bit more than just
    your articles? I mean, what you say is valuable and everything.
    Nevertheless think about if you added some great graphics or video clips to give your posts more, “pop”!

    Your content is excellent but with images and videos, this
    website could definitely be one of the best in its field.
    Superb blog!

  20. Nice post. I learn something totally new and challenging
    on websites I stumbleupon on a daily basis.
    It will always be helpful to read articles
    from other authors and practice a little something from other web sites.

  21. My coder is trying to convince me to move to .net from PHP.
    I have always disliked the idea because of the costs.
    But he’s tryiong none the less. I’ve been using WordPress on numerous
    websites for about a year and am concerned about switching to another platform.
    I have heard great things about blogengine.net.
    Is there a way I can import all my wordpress posts into it?
    Any help would be greatly appreciated!

  22. Thank you for the good writeup. It in fact was a amusement account it.
    Look advanced to more added agreeable from you! However, how can we communicate?

  23. I’m very pleased to uncover this website. I want to to thank
    you for your time due to this wonderful read!! I definitely enjoyed every bit of it and I have you book-marked to see new things in your site.

  24. 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 put 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!

Comments are closed.