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. I like the valuable info you provide for your articles.

    I will bookmark your weblog and take a look at again here regularly.
    I am moderately certain I’ll be informed a lot of new stuff proper here!
    Best of luck for the next!

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

  3. Ahaa, its nice conversation concerning this post here at this webpage, I have read
    all that, so at this time me also commenting here.

  4. I simply could not depart your site prior to suggesting that I actually loved the standard information an individual provide on your visitors?
    Is going to be again ceaselessly to check out new posts

  5. wonderful publish, very informative. I ponder why the other
    experts of this sector don’t understand this. You should continue
    your writing. I am confident, you have a great readers’ base already!

  6. Actually when someone doesn’t understand then its up to other viewers that they will assist,
    so here it happens.

  7. I’m curious to find out what blog platform you have
    been working with? I’m experiencing some minor
    security issues with my latest blog and I would like to find something more safe.
    Do you have any suggestions?

  8. I am curious to find out what blog system you have been working with?
    I’m experiencing some small security issues with
    my latest site and I’d like to find something more secure.

    Do you have any solutions?

  9. Hello, i think that i saw you visited my site thus i got here
    to go back the choose?.I’m attempting to find issues to improve my web site!I guess its adequate
    to make use of a few of your ideas!!

  10. I loved as much as you will receive carried out right here.
    The sketch is tasteful, 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 a lot
    often inside case you shield this increase.

  11. Excellent blog here! Also your web site loads up fast!
    What web host are you using? Can I get your affiliate link
    to your host? I wish my site loaded up as fast as yours lol

  12. Hola! I’ve been reading your web site for some time now and finally
    got the bravery to go ahead and give you a shout out from
    Huffman Texas! Just wanted to tell you keep up the great work!

  13. I absolutely love your site.. Great colors & theme.
    Did you create this site yourself? Please reply back as I’m hoping to create my very own blog
    and would like to learn where you got this from or exactly what the theme is called.
    Kudos!

  14. Excellent items from you, man. I’ve take note your stuff
    prior to and you’re simply too fantastic. I actually like what you’ve acquired right here, certainly like
    what you’re stating and the best way by which you say it.
    You’re making it entertaining and you still
    take care of to keep it sensible. I can not wait to learn far more from you.

    This is actually a terrific site.

  15. Appreciating the time and effort you put into your site and in depth information you present.
    It’s good to come across a blog every once in a while that isn’t the same old rehashed material.
    Excellent read! I’ve saved your site and I’m adding
    your RSS feeds to my Google account.

  16. Hi just wanted to give you a brief heads up and let you know a few of the pictures aren’t
    loading correctly. I’m not sure why but I think its a linking issue.
    I’ve tried it in two different web browsers and both
    show the same outcome.

  17. I’ve been exploring for a little bit for any high-quality articles or blog
    posts on this kind of space . Exploring in Yahoo I at
    last stumbled upon this web site. Studying this information So i am happy to express that I have a very good uncanny feeling I discovered exactly
    what I needed. I so much undoubtedly will make sure to don?t forget
    this site and give it a look regularly.

  18. I have fun with, cause I discovered exactly what I was taking a look for.
    You have ended my 4 day lengthy hunt! God Bless you man. Have a nice day.

    Bye

  19. Hello, i believe that i noticed you visited my weblog thus i got here
    to go back the want?.I’m attempting to find things to improve my web site!I assume its adequate
    to make use of a few of your ideas!!

  20. I loved as much as you will receive carried out right here.
    The sketch is tasteful, your authored subject matter stylish.
    nonetheless, you command get got an nervousness over that you wish be delivering the following.

    unwell unquestionably come further formerly again since exactly the same nearly very often inside case
    you shield this increase.

Comments are closed.