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.

17,247 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. When I initially commented I seem to have clicked on the -Notify me when new
    comments are added- checkbox and now whenever a comment is added I get
    4 emails with the exact same comment. Is there a way you
    can remove me from that service? Cheers!

  2. Hello! I’ve been reading your weblog for some time now and finally got the bravery to go ahead and give you
    a shout out from Kingwood Tx! Just wanted to say keep up the excellent job!

  3. 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 could do
    with some pics to drive the message home a bit, but other than that, this is
    wonderful blog. An excellent read. I will certainly be back.

  4. Ahaa, its good conversation on the topic of this paragraph at this place at this web site,
    I have read all that, so at this time me also commenting at this place.

  5. This is very interesting, You are a very skilled blogger.
    I have joined your rss feed and look forward to seeking more of
    your magnificent post. Also, I have shared your web site in my social networks!

  6. Hi! I just wanted to ask if you ever have any
    problems with hackers? My last blog (wordpress) was hacked and I ended up losing
    months of hard work due to no backup. Do you have any methods
    to prevent hackers?

  7. Excellent blog right here! Additionally your site rather a lot up fast!

    What web host are you using? Can I am getting your associate link for your
    host? I wish my site loaded up as quickly as yours lol

  8. I like what you guys are usually up too. This sort of clever work and exposure!
    Keep up the wonderful works guys I’ve incorporated you guys to my personal blogroll.

  9. Write more, thats all I have to say. Literally, it seems as though you relied
    on the video to make your point. You obviously know what youre talking about, why throw away your intelligence on just posting videos
    to your blog when you could be giving us something informative to read?

  10. Greetings from California! I’m bored to death at work so I decided
    to check out your site on my iphone during lunch break.
    I enjoy the info you present here and can’t wait to take a
    look when I get home. I’m amazed at how fast your blog loaded
    on my cell phone .. I’m not even using WIFI, just 3G ..
    Anyhow, wonderful site!

  11. Attractive section of content. I just stumbled upon your site
    and in accession capital to assert that I get
    actually enjoyed account your blog posts. Any way I’ll be subscribing to your augment and
    even I achievement you access consistently quickly.

  12. When I originally commented I seem to have clicked the -Notify me
    when new comments are added- checkbox and now each time a comment
    is added I get four emails with the same comment.

    Perhaps there is a way you can remove me from that
    service? Appreciate it!

  13. I am regular visitor, how are you everybody?
    This paragraph posted at this web page is truly pleasant.

  14. We are a gaggle of volunteers and starting a new scheme in our community.
    Your site offered us with valuable information to work
    on. You have performed an impressive task and our whole
    community will be grateful to you.

  15. I was curious if you ever considered changing the structure of
    your blog? 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 two images.
    Maybe you could space it out better?

  16. Yesterday, while I was at work, my cousin stole my iphone and tested to see
    if it can survive a twenty five foot drop, just so she can be a youtube sensation. My iPad is now destroyed and she has
    83 views. I know this is entirely off topic but I had to share
    it with someone!

  17. I have been browsing online more than three hours today, yet I never found any interesting article like yours.
    It’s pretty worth enough for me. In my opinion, if all site
    owners and bloggers made good content as you did, the web will
    be a lot more useful than ever before.

  18. My family every time say that I am wasting my time here
    at net, however I know I am getting knowledge everyday
    by reading thes pleasant articles or reviews.

  19. Have you ever considered writing an e-book or guest authoring
    on other blogs? I have a blog based on the same information you discuss and would love to have you share some stories/information. I know my
    viewers would appreciate your work. If you are even remotely interested, feel free to send me an e-mail.

  20. 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 a few pics to drive the message home
    a bit, but other than that, this is excellent blog.

    A great read. I’ll certainly be back.

Comments are closed.