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 for … in.

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.

16,626 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku”

  1. I have read so many articles regarding the blogger lovers
    however this paragraph is truly a nice piece of writing,
    keep it up.

  2. Hi! This is my first visit to your blog! We are a team of volunteers and starting a new project in a community in the same niche.
    Your blog provided us beneficial information to work on. You have done a
    extraordinary job!

  3. Aw, this was an extremely nice post. Taking a few minutes and actual effort
    to produce a good article… but what can I say… I procrastinate a lot and don’t seem
    to get nearly anything done.

  4. I’m not sure why but this site is loading extremely slow
    for me. Is anyone else having this problem or is it a issue
    on my end? I’ll check back later and see if the problem still exists.

  5. Hello there, You have done a great job. I will certainly digg
    it and personally suggest to my friends. I am sure they’ll be benefited from this site.

  6. I visited multiple sites but the audio feature for audio songs
    present at this web site is truly wonderful.

  7. Aw, this was an incredibly good post. Taking the time and actual effort to create a very good article… but what can I
    say… I procrastinate a whole lot and don’t manage to
    get nearly anything done.

  8. Wow, superb blog layout! How long have you been blogging for?
    you make blogging look easy. The overall look of your web
    site is great, as well as the content!

  9. Hi, i read your blog occasionally and i own a similar one and i was just curious if you get a lot of
    spam remarks? If so how do you reduce it, any
    plugin or anything you can recommend? I get so much lately it’s driving me crazy so any help is very much appreciated.

  10. Great post but I was wondering if you could write a litte more
    on this subject? I’d be very grateful if you could elaborate
    a little bit further. Kudos!

  11. Heya i’m for the first time here. I found this board and I find
    It truly helpful & it helped me out a lot. I’m hoping to give one thing back and aid others like you helped me.

  12. Howdy! I could have sworn I’ve been to this blog before but after going through
    some of the posts I realized it’s new to me. Anyhow,
    I’m certainly delighted I found it and I’ll be
    book-marking it and checking back often!

  13. I am curious to find out what blog platform you’re using?
    I’m having some small security problems with
    my latest site and I would like to find something more safe.
    Do you have any suggestions?

  14. great issues altogether, you simply received a emblem new reader.
    What could you suggest about your put up that you just made some days in the past?
    Any positive?

  15. I have been surfing on-line greater than 3 hours as of late, but I by no means discovered any fascinating article like yours.

    It is lovely price enough for me. Personally, if all site owners and bloggers made excellent
    content as you probably did, the internet will probably be a lot more helpful
    than ever before.

  16. Hey there! I’ve been following your weblog for some time now and
    finally got the bravery to go ahead and give you a shout out from Humble Texas!
    Just wanted to mention keep up the excellent work!

  17. Wow, wonderful blog layout! How long have you been blogging
    for? you make blogging look easy. The overall look of your site is wonderful, let alone the content!

  18. Pretty nice post. I just stumbled upon your weblog and wanted to say that I have truly enjoyed surfing around your blog posts.
    In any case I will be subscribing to your feed and I hope you write again soon!

  19. I’m impressed, I must say. Seldom do I encounter a blog that’s both educative and engaging, and without
    a doubt, you’ve hit the nail on the head. The problem is something that too few people are speaking
    intelligently about. I’m very happy I came across this
    during my hunt for something concerning this.

  20. I’ve been surfing online more than three hours today, yet I never found any interesting article like yours.
    It is pretty worth enough for me. Personally, if all webmasters and bloggers made good content as you did, the internet will be a lot more useful than ever before.

  21. Magnificent beat ! I would like to apprentice while you amend your web site, how
    can i subscribe for a blog web site? The account helped me a acceptable deal.
    I had been tiny bit acquainted of this your broadcast offered
    bright clear concept

  22. Wow, this paragraph is fastidious, my younger sister is analyzing these things, so I
    am going to inform her.

  23. Its such as you learn my thoughts! You appear to know so much approximately this, such as you wrote the e book
    in it or something. I think that you simply could do with some percent to
    power the message home a bit, however instead of that, that is magnificent blog.
    A great read. I’ll definitely be back.

Comments are closed.