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. Heya i’m for the first time here. I came across this board and I find It
    truly useful & it helped me out a lot. I hope to give something back and aid others like you aided me.

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

  3. I’ve been exploring for a bit for any high quality articles or weblog posts in this kind of area .
    Exploring in Yahoo I at last stumbled upon this site. Reading this information So i am glad to express that I’ve an incredibly excellent uncanny feeling I discovered exactly what
    I needed. I so much undoubtedly will make sure to don?t fail to remember this site and provides it a glance regularly.

  4. Its like you read my mind! You seem to know a lot about this, like you wrote the book in it or something.
    I think that you could do with some pics to drive
    the message home a bit, but instead of that, this is magnificent
    blog. A great read. I will certainly be back.

  5. Link exchange is nothing else however it is only placing the other person’s website link on your page at proper place and other
    person will also do similar in support of you.

  6. What’s up to every body, it’s my first pay a quick
    visit of this weblog; this weblog consists of remarkable and actually good stuff
    in support of readers.

  7. I’ve been surfing online more than 2 hours today, yet I never found any interesting article like yours.
    It is pretty worth enough for me. In my view, if all webmasters and bloggers made
    good content as you did, the web will be much more useful than ever before.

  8. What i don’t realize is in reality how you’re now not really a lot more well-favored than you
    may be right now. You’re very intelligent. You realize thus considerably in the case of this matter, produced me for my part consider it
    from numerous varied angles. Its like women and men aren’t fascinated
    unless it is one thing to do with Woman gaga!
    Your own stuffs excellent. All the time handle it up!

  9. Great post. I was checking constantly this blog and
    I am impressed! Extremely useful information particularly the last part
    🙂 I care for such info a lot. I was seeking this certain info for a
    very long time. Thank you and best of luck.

  10. hello there and thank you for your info – I’ve definitely picked up something new from
    right here. I did however expertise some technical issues using this website, as I experienced
    to reload the web site lots of times previous to I could get it to load correctly.
    I had been wondering if your web hosting is OK? Not that I’m complaining, but slow loading instances times will often affect your placement in google and could
    damage your high quality score if advertising and marketing with Adwords.
    Well I’m adding this RSS to my email and can look out for much more of your respective exciting content.
    Ensure that you update this again soon.

  11. You could certainly see your expertise within the article you write.

    The sector hopes for even more passionate writers like you who are not afraid to mention how they
    believe. At all times go after your heart.

  12. Quality articles or reviews is the secret to invite the viewers to pay a quick
    visit the web site, that’s what this web page is providing.

  13. Hi, Neat post. There is a problem along with your website in internet explorer,
    may test this? IE nonetheless is the market chief and
    a huge section of people will leave out your excellent writing due to this problem.

  14. hey there and thank you for your info – I’ve definitely picked
    up anything new from right here. I did however expertise some technical points using this site, since I
    experienced to reload the web site many 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 sometimes affect your placement in google
    and could 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 fascinating content. Ensure that you update this again very soon.

  15. My programmer 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 WordPress on a number of websites for about a year and am concerned
    about switching to another platform. I have heard good
    things about blogengine.net. Is there a way I can transfer all my wordpress
    posts into it? Any kind of help would be really appreciated!

  16. I was wondering if you ever thought of changing
    the structure 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 1
    or 2 pictures. Maybe you could space it out better?

  17. Undeniably believe that which you said. Your favorite reason seemed to be on the web the simplest thing to be aware of.
    I say to you, I definitely get annoyed while people think about worries that they just do not know about.
    You managed to hit the nail upon the top as well as defined out
    the whole thing without having side effect ,
    people can take a signal. Will probably be back to get more.
    Thanks

  18. It’s actually a cool and helpful piece of information. I’m happy that you just
    shared this useful information with us. Please keep us up to date like this.
    Thanks for sharing.

  19. I’m curious to find out what blog system you have been 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?

  20. I’m really loving the theme/design of your weblog.
    Do you ever run into any internet browser compatibility issues?
    A handful of my blog readers have complained about
    my blog not operating correctly in Explorer but looks great in Chrome.
    Do you have any tips to help fix this issue?

Comments are closed.