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

  1. fantastic issues altogether, you simply gained a logo new reader.
    What could you recommend in regards to your publish that you made a few days in the past?
    Any positive?

  2. No matter if some one searches for his essential thing, therefore he/she needs to
    be available that in detail, therefore that thing is maintained over here.

  3. Hi, I believe your web site may be having browser compatibility problems.
    Whenever I take a look at your web site in Safari, it looks fine however, if opening in I.E., it’s
    got some overlapping issues. I merely wanted to provide you with a quick heads up!
    Aside from that, wonderful blog!

  4. fantastic issues altogether, you just gained a new reader.
    What would you recommend about your submit that you
    simply made some days in the past? Any sure?

  5. Yesterday, while I was at work, my cousin stole my apple ipad and
    tested to see if it can survive a 30 foot drop, just so she can be
    a youtube sensation. My iPad is now broken and she has 83
    views. I know this is totally off topic but I had to share
    it with someone!

  6. I’m not sure exactly why but this blog is loading very 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. Attractive component to content. I simply stumbled upon your web site and in accession capital to say that I get in fact loved account your blog posts.
    Any way I’ll be subscribing on your feeds and even I success you get right
    of entry to constantly rapidly.

  8. I loved as much as you will receive carried out right here.

    The sketch is attractive, 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 as exactly the same nearly very often inside case
    you shield this hike.

  9. It’s a shame you don’t have a donate button! I’d certainly donate to this fantastic blog!
    I suppose for now i’ll settle for bookmarking 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. Talk soon!

  10. I am extremely impressed with your writing skills as well as with the layout on your weblog.
    Is this a paid theme or did you customize it yourself? Anyway keep up the nice
    quality writing, it is rare to see a nice blog like this one nowadays.

  11. I was wondering if you ever considered changing the structure of your site?

    Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of content so people could connect with it better.
    Youve got an awful lot of text for only having 1 or two images.

    Maybe you could space it out better?

  12. Howdy! This is kind of off topic but I need some
    guidance from an established blog. Is it difficult to set up your own blog?
    I’m not very techincal but I can figure things out pretty fast.
    I’m thinking about making my own but I’m not sure where to begin. Do
    you have any ideas or suggestions? Appreciate it

  13. Hiya! I know this is kinda off topic however , I’d figured I’d ask.
    Would you be interested in exchanging links or maybe guest
    authoring a blog post or vice-versa? My site addresses a lot of the same topics as yours
    and I believe we could greatly benefit from each other.
    If you’re interested feel free to send me an e-mail. I look forward to hearing from
    you! Excellent blog by the way!

Comments are closed.