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,249 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. Wow that was strange. I just wrote an extremely long comment but after I clicked
    submit my comment didn’t show up. Grrrr…
    well I’m not writing all that over again. Regardless, just wanted to say superb blog!

  2. At this time it sounds like Drupal is the preferred blogging platform available right now.

    (from what I’ve read) Is that what you’re using on your blog?

  3. Great beat ! I would like to apprentice while you amend your web site, how could i subscribe
    for a blog site? The account aided me a acceptable deal.

    I have been a little bit familiar of this your broadcast provided bright transparent concept

  4. Hi, i read your blog from time to time and i own a similar
    one and i was just wondering if you get a lot of spam remarks?
    If so how do you protect against it, any plugin or anything you
    can advise? I get so much lately it’s driving me crazy so
    any assistance is very much appreciated.

  5. Hi, i think that i saw you visited my web site so i came to “return the favor”.I am attempting
    to find things to improve my site!I suppose its ok to
    use a few of your ideas!!

  6. I’m not sure exactly why but this blog is loading incredibly slow for me.

    Is anyone else having this problem or is
    it a issue on my end? I’ll check back later on and see if the problem still exists.

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

  8. Hmm it appears like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I submitted and
    say, I’m thoroughly enjoying your blog. I too am an aspiring blog writer but
    I’m still new to everything. Do you have any points for beginner blog writers?
    I’d certainly appreciate it.

  9. I’ve been surfing on-line greater than three hours as of late,
    yet I never discovered any fascinating article like yours.
    It’s lovely value sufficient for me. In my view, if all web owners and bloggers made just right content material as you probably did, the
    internet will be much more useful than ever before.

  10. Have you ever thought about adding a little bit more than just your articles?
    I mean, what you say is important and all. Nevertheless think of if
    you added some great pictures or videos to give your posts more, “pop”!
    Your content is excellent but with images and video clips, this blog could undeniably be one of the most beneficial in its
    field. Excellent blog!

  11. Its like you learn my thoughts! You seem to grasp so
    much approximately this, like you wrote the book in it or something.
    I think that you simply could do with a few p.c.
    to pressure the message home a bit, however instead of
    that, that is magnificent blog. A great read. I’ll certainly be back.

  12. I loved as much as you’ll receive carried out right here.
    The sketch is attractive, your authored material stylish.

    nonetheless, you command get bought an impatience over that you wish be
    delivering the following. unwell unquestionably come more formerly again since exactly the same nearly very often inside case you shield this increase.

  13. Today, I went to the beach with my kids. I found a sea shell and gave it to my 4 year
    old daughter and said “You can hear the ocean if you put this to your ear.” She
    put the shell to her ear and screamed. There was a hermit crab inside and it
    pinched her ear. She never wants to go back! LoL I know this is
    completely off topic but I had to tell someone!

  14. What’s Taking place i am new to this, I stumbled upon this I’ve discovered It absolutely helpful and it has helped me out
    loads. I hope to contribute & help other users like its aided me.
    Good job.

  15. of course like your web site however you need to check the spelling
    on quite a few of your posts. Several of them are rife with spelling problems and I in finding it very troublesome to inform the reality then again I will definitely come again again.

  16. Howdy! I could have sworn I’ve been to this site before
    but after browsing through some of the post I realized it’s new to me.

    Anyways, I’m definitely happy I found it and I’ll be bookmarking and checking
    back often!

  17. I’ve been exploring for a bit for any high-quality articles or blog posts in this sort of area .
    Exploring in Yahoo I eventually stumbled upon this site.
    Reading this information So i’m happy to exhibit that I have a very
    good uncanny feeling I came upon exactly what I needed.
    I most indisputably will make certain to don?t disregard this
    site and give it a glance regularly.

  18. I have been browsing on-line more than 3 hours nowadays, yet I by no means found
    any fascinating article like yours. It is lovely worth enough for
    me. In my opinion, if all webmasters and bloggers made just
    right content as you probably did, the net might be much more helpful than ever before.

  19. What i don’t understood is in fact how you are no longer actually much more well-preferred than you
    might be now. You are so intelligent. You understand therefore considerably on the subject of this
    matter, produced me individually believe it from so many varied angles.
    Its like men and women are not interested except it’s something to
    do with Woman gaga! Your personal stuffs outstanding.
    All the time care for it up!

  20. If some one wishes expert view regarding blogging and site-building afterward i advise him/her to
    pay a quick visit this webpage, Keep up the fastidious job.

  21. Hi, I do think this is a great site. I stumbledupon it 😉 I may come back yet again since
    i have book marked it. Money and freedom is the best way to change, may you be rich and continue to help other people.

  22. Today, I went to the beach front with my children. I
    found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.”
    She put the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear.
    She never wants to go back! LoL I know this is completely off topic but I had
    to tell someone!

  23. Hi, i read your blog occasionally and i own a similar one and i was just wondering if you get a
    lot of spam feedback? If so how do you stop 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.

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

Comments are closed.