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.

17,247 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. I have been surfing on-line greater than three hours lately, yet I by
    no means found any interesting article like yours.
    It’s lovely value sufficient for me. In my view, if all site owners and
    bloggers made excellent content material as you
    probably did, the internet might be a lot more useful than ever before.

  2. You could definitely see your skills within the work you write.

    The arena hopes for even more passionate writers like you who aren’t afraid to mention how they believe.
    At all times go after your heart.

  3. I’m amazed, I must say. Seldom do I come across a blog that’s both
    equally educative and amusing, and without a doubt, you’ve hit the nail on the head.
    The problem is something which not enough people are
    speaking intelligently about. Now i’m very happy I stumbled across this during my search
    for something regarding this.

  4. Hello everyone, it’s my first pay a quick visit at this web site, and article
    is actually fruitful designed for me, keep up posting these types of content.

  5. What’s Going down i am new to this, I stumbled upon this I
    have discovered It absolutely helpful and it has aided me out loads.

    I hope to contribute & help different customers like its aided me.
    Great job.

  6. I just like the valuable information you supply on your
    articles. I’ll bookmark your blog and take a look at once more right here frequently.
    I’m moderately certain I’ll be informed many new stuff proper here!

    Best of luck for the following!

  7. What’s up everybody, here every one is sharing these kinds of experience, therefore it’s
    good to read this blog, and I used to visit this
    web site everyday.

  8. Howdy just wanted to give you a brief heads up
    and let you know a few of the images aren’t loading properly.
    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.

    My web blog … docs.vcloud.ai

  9. Valuable info. Lucky me I discovered your web site by chance, and I’m stunned why this accident didn’t came about earlier!
    I bookmarked it.

  10. Hi there this is kinda of off topic but I was wanting to know if blogs use WYSIWYG editors or if you have to manually code with HTML.
    I’m starting a blog soon but have no coding expertise so I
    wanted to get guidance from someone with experience.
    Any help would be enormously appreciated!

  11. When I initially commented I clicked the “Notify me when new comments are added” checkbox and now
    each time a comment is added I get four e-mails with the same comment.
    Is there any way you can remove me from that service?
    Appreciate it!

    Feel free to visit my site; agen s128

  12. Hi there! This is kind of off topic but I need some guidance from an established blog.

    Is it hard to set up your own blog? I’m not
    very techincal but I can figure things out pretty quick.
    I’m thinking about setting up my own but I’m not sure where to begin. Do you have
    any ideas or suggestions? Cheers

  13. all the time i used to read smaller articles that also clear their motive, and that is also happening with this piece of writing which I am reading now.

  14. Hi there i am kavin, its my first occasion to commenting anyplace, when i read this piece
    of writing i thought i could also make comment due to this good piece of writing.

  15. Hello this is kind of of off topic but I was wanting
    to know if blogs use WYSIWYG editors or if you have to
    manually code with HTML. I’m starting a blog soon but have no coding expertise so I wanted
    to get advice from someone with experience. Any help would be greatly appreciated!

Comments are closed.