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.

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

  1. hello!,I love your writing so much! share we keep in touch more about
    your article on AOL? I need an expert in this house
    to unravel my problem. Maybe that’s you! Having a look forward
    to peer you.

  2. I’m truly 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?
    Fantastic work!

  3. Hey there, You have done a fantastic job. I’ll definitely digg it and personally suggest to my friends.
    I am sure they’ll be benefited from this site.

  4. Hello there! I just wish to give you a big thumbs up for the great
    information you have got here on this post. I’ll
    be returning to your blog for more soon.

  5. Attractive element of content. I just stumbled upon your
    weblog and in accession capital to assert that I acquire in fact enjoyed account your
    blog posts. Any way I will be subscribing for your feeds
    and even I achievement you access persistently quickly.

  6. Wonderful goods from you, man. I’ve understand your
    stuff previous to and you are just too great. I actually like what you’ve acquired
    here, certainly like what you’re stating and the way in which you say it.
    You make it enjoyable and you still take care of to keep it smart.
    I cant wait to read far more from you. This is actually a terrific web site.

  7. It’s a pity you don’t have a donate button!
    I’d certainly donate to this brilliant blog! I suppose for now i’ll settle for book-marking and adding your RSS feed to my Google account.
    I look forward to brand new updates and will talk
    about this blog with my Facebook group. Talk soon!

  8. Today, I went to the beach front 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 entirely off topic but I had to tell someone!

  9. Hi my family member! I wish to say that this post is amazing,
    nice written and come with approximately all important infos.

    I’d like to see more posts like this .

  10. Its like you learn my mind! You appear to grasp a lot approximately this,
    such as you wrote the e-book in it or something. I believe that
    you can do with a few p.c. to power the message house a little bit, but other than that, this is fantastic blog.
    A great read. I’ll definitely be back.

  11. Hello everyone, it’s my first pay a visit at this site, and paragraph is actually fruitful designed for me, keep up posting these content.

  12. It’s a shame you don’t have a donate button! I’d definitely donate to this fantastic blog!
    I guess for now i’ll settle for book-marking and adding your RSS feed to my Google account.
    I look forward to brand new updates and will talk about
    this site with my Facebook group. Chat soon!

  13. Its like you read my mind! You seem to understand so much
    approximately this, like you wrote the book in it or something.
    I think that you can do with some percent to drive the message house a bit, however
    instead of that, this is fantastic blog. An excellent read.
    I will definitely be back.

  14. My spouse and I stumbled over here by a different web page
    and thought I might as well check things out.
    I like what I see so now i’m following you. Look forward to checking out your web page again.

  15. Hi every one, here every person is sharing these kinds of familiarity, so
    it’s nice to read this web site, and I used to go to see this webpage daily.

  16. What’s up to all, how is everything, I think every one
    is getting more from this web site, and your views are
    pleasant in favor of new people.

  17. You could definitely see your enthusiasm in the article you write.
    The sector hopes for even more passionate writers like you who are not afraid to mention how they believe.
    All the time go after your heart.

  18. When I initially commented I appear to have clicked the -Notify me when new comments are added- checkbox and from
    now on whenever a comment is added I receive four emails with the exact same comment.

    Is there a way you are able to remove me from that service?
    Cheers!

  19. What’s up to all, the contents existing at this web page are actually
    amazing for people knowledge, well, keep up the nice work fellows.

  20. I don’t even understand how I stopped up right here,
    however I assumed this publish used to be good. I don’t
    realize who you are but definitely you’re going to a well-known blogger if you happen to aren’t already.
    Cheers!

Comments are closed.