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. Hello There. I found your blog using msn. This is
    a very well written article. I’ll be sure to bookmark it and return to read more
    of your useful info. Thanks for the post. I will definitely comeback.

  2. 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.

  3. 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?

  4. A motivating discussion is definitely worth comment. I
    do think that you need to publish more on this subject, it may not be a taboo subject but
    usually people don’t speak about such topics. To the next!
    Many thanks!!

  5. 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.

  6. 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.

  7. It’s perfect time to make some plans for the future and it’s time
    to be happy. I’ve read this post and if I could I desire to suggest you some interesting things or tips.
    Maybe you can write next articles referring to this article.
    I wish to read more things about it!

  8. Oh my goodness! Awesome article dude! Thank you so much, However I am experiencing difficulties with
    your RSS. I don’t know the reason why I cannot join it. Is there
    anybody else having similar RSS problems? Anybody who knows the answer will you kindly respond?
    Thanx!!

  9. Do you have a spam issue on this site; I also am a
    blogger, and I was wondering your situation; we
    have created some nice methods and we are looking to swap
    strategies with other folks, please shoot me an email if
    interested.

  10. obviously like your website but you need to test the spelling on quite a
    few of your posts. Many of them are rife with spelling problems and I in finding
    it very troublesome to tell the truth on the other hand I’ll definitely come back again.

  11. 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!

  12. Magnificent items from you, man. I’ve consider your stuff prior to and
    you are simply too great. I actually like what you have obtained here,
    certainly like what you are saying and the way in which wherein you say it.

    You make it enjoyable and you still take care of to
    stay it smart. I can not wait to learn far more from you.
    That is really a terrific web site.

  13. 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.

  14. 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.

  15. 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!

  16. Appreciating the commitment you put into your website and
    detailed information you provide. It’s good to come across a blog every
    once in a while that isn’t the same old rehashed material.
    Great read! I’ve bookmarked your site and I’m including your
    RSS feeds to my Google account.

  17. 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.

  18. Hmm it looks like your website ate my first comment (it was
    super long) so I guess I’ll just sum it up what
    I had written 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 suggestions for rookie blog writers?
    I’d definitely appreciate it.

  19. 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.

  20. 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!

  21. Unquestionably consider that which you stated. Your favorite justification seemed to be on the
    web the simplest thing to understand of. I say to you, I certainly get annoyed whilst other people consider concerns
    that they plainly do not recognise about. You controlled to hit the nail upon the top
    and outlined out the entire thing without having
    side effect , people could take a signal. Will likely be
    again to get more. Thanks

  22. Hello! I know this is somewhat off topic but I was wondering if you knew where
    I could get a captcha plugin for my comment form?
    I’m using the same blog platform as yours and I’m having problems finding one?

    Thanks a lot!

  23. I enjoy what you guys tend to be up too.
    Such clever work and reporting! Keep up the awesome works guys I’ve added you
    guys to my personal blogroll.

Comments are closed.