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 for … in.

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

  1. You can certainly see your skills within the work you write.
    The arena hopes for more passionate writers such as you who aren’t afraid to say how they believe.
    At all times go after your heart.

  2. My partner and I stumbled over here coming from a different web
    page and thought I should check things out. I like what I see so now i’m following you.
    Look forward to checking out your web page again.

  3. Have you ever considered about including a little bit more than just your articles?
    I mean, what you say is valuable and everything. Nevertheless
    imagine if you added some great images or video
    clips to give your posts more, “pop”! Your content is excellent but with images and clips, this blog could undeniably be one of the most beneficial in its
    field. Very good blog!

  4. Have you ever considered about including a
    little bit more than just your articles? I mean, what you say is important and everything.
    But just imagine if you added some great pictures or video clips to give your posts more, “pop”!
    Your content is excellent but with images and clips, this site could undeniably be one of
    the very best in its field. Fantastic blog!

  5. Have you ever thought about adding a little bit more than just your articles?
    I mean, what you say is important and everything. Nevertheless
    imagine if you added some great photos or video clips to give your posts
    more, “pop”! Your content is excellent but with pics and video clips, this blog
    could definitely be one of the most beneficial in its field.
    Superb blog!

  6. Attractive component to content. I just stumbled upon your blog and in accession capital to claim that I acquire actually loved account your weblog posts.
    Any way I’ll be subscribing to your feeds and even I success you
    get right of entry to constantly rapidly.

  7. Link exchange is nothing else however it is simply placing the other person’s weblog link on your page at proper place and other person will also do same in support of you.

  8. There’s definately a great deal to learn about this subject.
    I like all of the points you’ve made.

  9. Greetings from Los angeles! I’m bored to tears at work so I
    decided to browse your site on my iphone during
    lunch break. I enjoy the info you provide here and can’t wait to take a look when I get
    home. I’m surprised at how fast your blog loaded on my phone ..
    I’m not even using WIFI, just 3G .. Anyhow, excellent blog!

  10. Hello! I’ve been reading your weblog for a while now and
    finally got the courage to go ahead and give you a shout out from Humble
    Tx! Just wanted to say keep up the excellent work!

  11. I have learn a few excellent stuff here. Certainly value bookmarking for revisiting.
    I wonder how a lot effort you set to create this kind of wonderful informative web site.

  12. Pretty section of content. I just stumbled upon your blog and in accession capital to assert that I acquire actually enjoyed account your blog posts.
    Any way I will be subscribing to your feeds and even I achievement you access consistently fast.

  13. 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 blogger but I’m still
    new to everything. Do you have any tips for rookie blog writers?
    I’d certainly appreciate it.

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

  15. I’m curious to find out what blog system you happen to be working with?
    I’m having some minor security issues with my latest blog and
    I would like to find something more secure.

    Do you have any suggestions?

  16. I have been exploring for a little bit for any high quality articles or weblog posts in this kind of house .

    Exploring in Yahoo I finally stumbled upon this site. Studying this information So i’m glad to exhibit
    that I’ve an incredibly good uncanny feeling I discovered exactly what I needed.
    I most certainly will make sure to don?t
    overlook this web site and give it a look regularly.

  17. I’m curious to find out what blog system you’re utilizing?
    I’m having some minor security problems with my latest
    site and I would like to find something more secure.
    Do you have any suggestions?

  18. I’m impressed, I must say. Seldom do I come across a blog that’s both educative and entertaining, and let me
    tell you, you have hit the nail on the head.
    The problem is something that not enough men and women are speaking intelligently about.
    I am very happy I came across this in my hunt for something relating to this.

  19. Everyone loves what you guys are usually up too.
    This kind of clever work and reporting! Keep up the superb
    works guys I’ve included you guys to my blogroll.

Comments are closed.