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 am extremely impressed together with your writing talents as
    well as with the format for your blog. Is that this a paid subject matter or did you modify it yourself?
    Anyway stay up the nice high quality writing, it’s rare to see a great blog like this one these days..

  2. What’s Taking place i’m new to this, I stumbled upon this I have discovered It absolutely
    helpful and it has aided me out loads. I hope to contribute & aid different users
    like its helped me. Good job.

  3. Hello fantastic blog! Does running a blog such
    as this take a great deal of work? I’ve very little understanding of computer programming however I was hoping to start my
    own blog soon. Anyway, should you have any suggestions or techniques for new blog
    owners please share. I know this is off subject nevertheless I simply wanted to ask.
    Kudos!

  4. Hello there! I could have sworn I’ve been to this site before but after reading through some of the post I realized it’s
    new to me. Anyhow, I’m definitely delighted I found it and
    I’ll be book-marking and checking back frequently!

  5. I’m gone to inform my little brother, that he should also go to see this web site on regular basis to
    obtain updated from latest news update.

  6. I am extremely impressed with your writing skills and also 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 great blog like this one these days.

  7. This piece of writing will help the internet people
    for creating new web site or even a weblog from start
    to end.

  8. I’m not sure exactly why but this blog is loading extremely slow for me.
    Is anyone else having this issue or is it a problem on my
    end? I’ll check back later and see if the problem still exists.

  9. Wow that was strange. I just wrote an very 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 excellent blog!

  10. Asking questions are actually fastidious thing if
    you are not understanding something totally, but this piece of writing offers pleasant understanding yet.

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

  12. Hey there! I know this is kinda off topic however , I’d figured
    I’d ask. Would you be interested in exchanging links or maybe guest writing a blog
    post or vice-versa? My site covers a lot of the same topics as yours
    and I think we could greatly benefit from each other.
    If you might be interested feel free to send me an email.

    I look forward to hearing from you! Fantastic blog by
    the way!

  13. Hey there! Do you know if they make any plugins to help with SEO?
    I’m trying to get my blog to rank for some targeted
    keywords but I’m not seeing very good results.
    If you know of any please share. Cheers!

  14. Having read this I believed it was extremely informative.
    I appreciate you spending some time and effort to put this informative
    article together. I once again find myself personally spending a lot
    of time both reading and leaving comments. But so what, it
    was still worthwhile!

  15. Today, I went to the beachfront 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 totally off topic but I had to tell someone!

Comments are closed.