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. you are in reality a good webmaster. The web site loading speed is amazing.
    It kind of feels that you are doing any unique trick.

    Furthermore, The contents are masterwork. you’ve performed a fantastic job
    on this matter!

  2. Oh my goodness! Amazing article dude! Thanks, However
    I am going through issues with your RSS. I don’t know the reason why I can’t subscribe to it.
    Is there anybody getting identical RSS issues? Anybody who knows
    the solution will you kindly respond? Thanks!!

  3. We stumbled over here coming from a different page and thought I should check things
    out. I like what I see so now i am following you. Look forward to exploring your web page for a second time.

  4. I was curious if you ever thought of changing the layout of your website?
    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 1 or 2 images.
    Maybe you could space it out better?

  5. Greetings! I know this is kinda off topic but I was wondering if you knew where I could find a captcha
    plugin for my comment form? I’m using the same blog platform as yours and
    I’m having trouble finding one? Thanks a lot!

  6. This is really interesting, You’re a very skilled blogger.
    I have joined your feed and look forward to seeking more of your fantastic post.
    Also, I’ve shared your website in my social networks!

  7. Excellent post. I was checking constantly this blog and I’m
    impressed! Extremely helpful information specifically the last part :
    ) I care for such information much. I was looking for this particular info for a very long time.
    Thank you and best of luck.

  8. Hi, Neat post. There is an issue along with your website
    in internet explorer, may check this? IE nonetheless is
    the market leader and a large portion of other folks
    will miss your great writing due to this problem.

  9. I absolutely love your website.. Excellent colors &
    theme. Did you develop this site yourself? Please reply back as I’m planning to create my
    own website and would love to find out where you got
    this from or what the theme is called. Appreciate it!

  10. Have you ever considered writing an ebook or guest authoring on other sites?
    I have a blog based upon on the same information you
    discuss and would love to have you share some stories/information. I know my subscribers would appreciate your work.
    If you’re even remotely interested, feel free
    to shoot me an e-mail.

  11. Do you mind if I quote a few of your posts as long as I provide credit and sources
    back to your webpage? My website is in the exact same niche as yours and my visitors would genuinely benefit from a lot of the information you provide here.
    Please let me know if this alright with you. Cheers!

  12. We are a group of volunteers and opening a new scheme in our community.
    Your web site provided us with valuable information to work on. You’ve done a formidable job and our whole community
    will be thankful to you.

  13. This is really fascinating, You are an excessively skilled blogger.
    I have joined your rss feed and sit up for seeking more of your
    fantastic post. Additionally, I’ve shared
    your web site in my social networks

  14. Thanks for a marvelous posting! I really enjoyed reading it, you could be a great author.I will remember to bookmark your blog
    and will often come back very soon. I want to encourage you
    to continue your great posts, have a nice day!

  15. Hi there! I could have sworn I’ve been to this site before but after going through many
    of the posts I realized it’s new to me. Nonetheless, I’m certainly pleased I discovered it
    and I’ll be book-marking it and checking back often!

  16. Excellent post. I was checking continuously this blog and I am
    impressed! Very useful info specially the last part 🙂 I care for such info much.
    I was looking for this particular information for a long time.
    Thank you and best of luck.

  17. After exploring a number of the articles on your web page, I honestly appreciate your technique
    of writing a blog. I book-marked it to my bookmark website list and will be checking back in the near future.

    Please visit my website as well and tell me your opinion.

  18. I’m impressed, I must say. Rarely do I encounter a blog
    that’s equally educative and amusing, and let me tell you, you’ve hit the nail
    on the head. The issue is something too few people are speaking intelligently about.
    I’m very happy I found this during my hunt for something
    concerning this.

  19. Hi just wanted to give you a quick heads up and let you know a few of
    the pictures aren’t loading properly. 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.

  20. Hi! I could have sworn I’ve been to this blog before but after checking
    through some of the post I realized it’s new to me. Nonetheless, I’m definitely delighted I found
    it and I’ll be book-marking and checking back frequently!

  21. An impressive share! I’ve just forwarded this onto a coworker who has been doing
    a little homework on this. And he actually bought me lunch
    because I found it for him… lol. So allow me to
    reword this…. Thank YOU for the meal!! But yeah, thanks for spending some
    time to talk about this matter here on your web page.

  22. Howdy this is somewhat of off topic but I was wanting to know if
    blogs use WYSIWYG editors or if you have to manually code with HTML.
    I’m starting a blog soon but have no coding expertise so I wanted to get guidance from someone with experience.
    Any help would be greatly appreciated!

  23. Hey there! Quick question that’s completely off topic.

    Do you know how to make your site mobile friendly?
    My website looks weird when viewing from my apple
    iphone. I’m trying to find a template or plugin that might be able to fix this problem.
    If you have any suggestions, please share. Thank
    you!

  24. Heya i’m for the first time here. I found this board and I
    to find It really helpful & it helped me out a lot.
    I am hoping to give something back and help others such as
    you aided me.

  25. Simply desire to say your article is as surprising.
    The clearness in your post is simply cool and
    i could assume you are an expert on this subject. Well with your permission allow me to grab your feed to
    keep updated with forthcoming post. Thanks a million and please continue the gratifying work.

  26. I am curious to find out what blog system you are utilizing?

    I’m having some small security problems with my latest blog and I would like to find something more secure.
    Do you have any recommendations?

Comments are closed.