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 really make it appear so easy along with your presentation but
    I to find this topic to be really one thing that I think I’d never understand.
    It seems too complicated and extremely large for me.
    I am looking forward to your subsequent submit, I’ll
    try to get the hang of it!

  2. I think the admin of this site is really working hard for his web site, for the reason that here every information is quality based information.

  3. Undeniably believe that which you stated. Your favorite justification appeared to be on the internet the simplest thing to be
    aware of. I say to you, I definitely get annoyed while people consider worries that they plainly do not know
    about. You managed to hit the nail upon the top and also defined out the whole thing without having side-effects , people
    can take a signal. Will probably be back to get more. Thanks

  4. My brother recommended I might like this blog. He was
    entirely right. This post truly made my day.
    You cann’t imagine just how much time I had spent for this info!

    Thanks!

  5. Hello just wanted to give you a quick heads up. The words in your article seem to be running off the screen in Opera.
    I’m not sure if this is a format issue or something to do with
    browser compatibility but I thought I’d post to let you know.
    The layout look great though! Hope you get the problem solved soon. Thanks

  6. Hey, I think your blog might be having browser compatibility
    issues. When I look at your blog site in Chrome, it looks fine but when opening in Internet Explorer, it has some
    overlapping. I just wanted to give you a quick heads up!
    Other then that, excellent blog!

  7. Its like you read my mind! You appear to know so much about this, like you wrote the book in it or something.
    I think that you can do with a few pics to drive the message home a bit, but instead of that, this is fantastic blog.
    An excellent read. I will definitely be back.

  8. Does your site have a contact page? I’m having a tough time locating it but, I’d
    like to send you an e-mail. I’ve got some recommendations for
    your blog you might be interested in hearing. Either way, great site and I look
    forward to seeing it expand over time.

  9. We are a gaggle of volunteers and starting a brand new scheme in our community.
    Your website provided us with useful information to
    work on. You’ve done an impressive process and our whole group
    will probably be thankful to you.

  10. First of all I would like to say terrific blog! I had a quick question that I’d like
    to ask if you don’t mind. I was curious to find out how you center yourself
    and clear your mind prior to writing. I have had a
    tough time clearing my thoughts in getting my ideas out.
    I do take pleasure in writing however it just seems like the first 10 to
    15 minutes are usually wasted just trying to figure out how to begin. Any suggestions
    or hints? Thanks!

  11. Excellent post. I was checking constantly this weblog and I am impressed!
    Extremely helpful information specially the ultimate section :
    ) I care for such information much. I used to be seeking this
    particular info for a very long time. Thank you and best of luck.

  12. Aw, this was an incredibly good post. Finding the time and actual effort to make a really good article… but what can I say… I procrastinate a lot and
    don’t manage to get nearly anything done.

  13. It’s actually very complex in this full of
    activity life to listen news on Television, thus I just use the web for that reason,
    and get the hottest news.

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

  15. I have been surfing on-line more than three hours as of late, yet I never found any fascinating article like yours.

    It is pretty worth sufficient for me. Personally, if all site owners and bloggers made good content as you
    did, the net shall be much more useful than ever before.

  16. Howdy! Do you know if they make any plugins to safeguard against hackers?
    I’m kinda paranoid about losing everything I’ve worked hard on. Any recommendations?

  17. Does your site have a contact page? I’m having problems locating
    it but, I’d like to send you an email. I’ve got some recommendations for your blog
    you might be interested in hearing. Either way, great site and I
    look forward to seeing it develop over time.

  18. Hello outstanding website! Does running a blog such as this require a massive amount work?
    I have absolutely no knowledge of computer programming however I was hoping to start my own blog in the near future.
    Anyway, if you have any recommendations or techniques for new blog owners please share.
    I understand this is off subject however I just wanted to ask.
    Thanks!

  19. I’m really enjoying the design and layout of your blog. It’s a very easy
    on the eyes which makes it much more enjoyable for me to
    come here and visit more often. Did you hire out a
    developer to create your theme? Great work!

  20. Wonderful goods from you, man. I’ve understand your stuff previous
    to and you’re just too great. I really like what you have acquired here, really like what you’re stating and the way
    in which you say it. You make it enjoyable and you still care for to keep it
    sensible. I can’t wait to read much more from you. This is actually a wonderful website.

Comments are closed.