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. Hello would you mind stating which blog platform you’re using?
    I’m going to start my own blog in the near future but I’m having a hard time
    choosing 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 completely unique.

    P.S Apologies for being off-topic but I had to ask!

  2. Appreciating the time and effort you put into your site and in depth information you present.
    It’s good to come across a blog every once in a while that isn’t the same old rehashed material.
    Excellent read! I’ve saved your site and I’m adding
    your RSS feeds to my Google account.

  3. Hi just wanted to give you a brief heads up and let you know a few of the pictures aren’t
    loading correctly. I’m not sure why but I think its a linking issue.
    I’ve tried it in two different web browsers and both
    show the same outcome.

  4. You actually make it seem so easy with your presentation but
    I find this matter to be actually something which I think I would never understand.
    It seems too complex and very broad for me.
    I am looking forward for your next post, I’ll try to get the hang of it!

  5. I’ve been exploring for a little bit for any high-quality articles or blog
    posts on this kind of space . Exploring in Yahoo I at
    last stumbled upon this web site. Studying this information So i am happy to express that I have a very good uncanny feeling I discovered exactly
    what I needed. I so much undoubtedly will make sure to don?t forget
    this site and give it a look regularly.

  6. My coder is trying to persuade 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 Movable-type
    on various 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 really appreciated!

  7. I have fun with, cause I discovered exactly what I was taking a look for.
    You have ended my 4 day lengthy hunt! God Bless you man. Have a nice day.

    Bye

  8. Hello, i believe that i noticed you visited my weblog thus i got here
    to go back the want?.I’m attempting to find things to improve my web site!I assume its adequate
    to make use of a few of your ideas!!

  9. Thank you for some other excellent post. Where else may just anyone get
    that kind of info in such an ideal means of writing? I have a presentation next week, and I am on the
    look for such info.

  10. You have made some decent points there. I checked on the internet to find out more about the issue
    and found most people will go along with your views on this website.

  11. Hi, I do believe your blog might be having web browser compatibility
    issues. Whenever I take a look at your website
    in Safari, it looks fine however, when opening in I.E.,
    it has some overlapping issues. I merely wanted to provide you with a quick heads up!
    Other than that, wonderful blog!

  12. I loved as much as you will receive carried out right here.
    The sketch is tasteful, your authored subject matter stylish.
    nonetheless, you command get got an nervousness over that you wish be delivering the following.

    unwell unquestionably come further formerly again since exactly the same nearly very often inside case
    you shield this increase.

  13. Hi, i believe that i saw you visited my web site thus i came to
    return the choose?.I am attempting to to find things to enhance my website!I assume its good enough to
    make use of some of your ideas!!

  14. Please let me know if you’re looking for a author for your site.
    You have some really good articles and I believe I would be
    a good asset. If you ever want to take some of the load off, I’d absolutely love to write some material for your blog in exchange
    for a link back to mine. Please shoot me an email if interested.
    Many thanks!

  15. I don’t know whether it’s just me or if perhaps everybody else encountering problems with your website.

    It appears as if some of the text on your posts are running off the
    screen. Can someone else please provide feedback and let me know if this is
    happening to them too? This might be a issue with my web browser
    because I’ve had this happen previously. Thank you

  16. I really like looking through an article that will make men and women think.

    Also, thank you for permitting me to comment!

  17. Hi! This is my 1st comment here so I just wanted to
    give a quick shout out and tell you I genuinely enjoy reading through your blog posts.
    Can you recommend any other blogs/websites/forums
    that go over the same topics? Thanks a ton!

  18. Magnificent beat ! I wish to apprentice even as you amend your web
    site, how can i subscribe for a blog website?

    The account aided me a acceptable deal. I had been tiny bit familiar of this your broadcast offered
    vivid transparent concept

  19. Do you have a spam issue on this site; I also am a blogger, and I was wanting to know your situation; we have created some nice
    practices and we are looking to swap strategies with other folks, please shoot me an email if interested.

  20. First off I would like to say superb blog! I had a quick question that I’d like to ask
    if you don’t mind. I was interested to know how you center yourself and clear your thoughts prior to writing.
    I’ve had a hard time clearing my mind in getting my ideas out
    there. I do take pleasure in writing however it just seems like the first 10 to 15 minutes are
    lost simply just trying to figure out how to begin. Any recommendations or hints?
    Many thanks!

  21. you’re truly a excellent webmaster. The web site loading pace is amazing.
    It seems that you’re doing any distinctive trick. Furthermore, The contents are masterpiece.
    you’ve performed a excellent process on this topic!

  22. I know this if off topic but I’m looking into starting my own blog and was wondering what all
    is required to get setup? I’m assuming having a blog like yours
    would cost a pretty penny? I’m not very internet savvy so I’m not 100% certain. Any
    suggestions or advice would be greatly appreciated. Thanks

  23. Its such as you read my mind! You seem to grasp a lot approximately this,
    like you wrote the guide in it or something. I think that you just can do
    with some % to drive the message home a bit, but other than that, this is wonderful blog.
    A fantastic read. I’ll certainly be back.

  24. It’s a shame you don’t have a donate button! I’d certainly donate to this
    superb blog! I guess for now i’ll settle for book-marking and adding your RSS feed to my Google account.
    I look forward to brand new updates and will share this blog
    with my Facebook group. Chat soon!

  25. Hi there I am so thrilled I found your webpage, I really
    found you by accident, while I was looking on Askjeeve for
    something else, Regardless I am here now and would just like to say
    thanks for a fantastic post and a all round interesting blog
    (I also love the theme/design), I don’t have time to browse it all at the
    minute but I have bookmarked it and also included your RSS feeds,
    so when I have time I will be back to read a lot more, Please do keep up the superb job.

Comments are closed.