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. I have read so many articles or reviews on the topic of the
    blogger lovers except this article is actually a pleasant
    paragraph, keep it up.

  2. Nice weblog here! Also your site rather a lot up fast!
    What host are you the use of? Can I am getting your associate hyperlink on your host?
    I want my site loaded up as quickly as yours lol

  3. I don’t even know how I ended up here, but I thought this post was great.
    I don’t know who you are but certainly you’re going to a famous blogger if you aren’t already 😉 Cheers!

  4. I don’t even know how I ended up here, but I thought this post was good.
    I do not know who you are but definitely you’re going to a
    famous blogger if you aren’t already 😉 Cheers!

  5. Have you ever thought about including a little
    bit more than just your articles? I mean, what you say is fundamental and everything.
    However think of if you added some great pictures or videos to
    give your posts more, “pop”! Your content is excellent but with images
    and video clips, this site could definitely be one of the most beneficial in its niche.
    Good blog!

  6. Everyone loves what you guys are usually up too. Such clever work and coverage!

    Keep up the excellent works guys I’ve added you guys to
    my blogroll.

  7. Its such as you read my thoughts! You appear to grasp so much
    about this, like you wrote the e-book in it or something.
    I feel that you just can do with some % to
    pressure the message home a little bit, however instead of
    that, this is great blog. A fantastic read.
    I’ll definitely be back.

  8. It is not my first time to pay a visit this web site,
    i am visiting this web site dailly and obtain fastidious information from here everyday.

  9. Hey there, You have done a fantastic job. I’ll definitely
    digg it and personally suggest to my friends.

    I am confident they’ll be benefited from this site.

  10. We stumbled over here by a different web address and thought I may as well check things out.
    I like what I see so i am just following you.

    Look forward to finding out about your web page repeatedly.

  11. Hi, this weekend is pleasant designed for me, for the reason that this
    occasion i am reading this enormous informative post here at my residence.

  12. I feel this is one of the such a lot vital
    information for me. And i’m happy studying your article. However should statement
    on few general issues, The web site style is perfect, the articles
    is in point of fact excellent : D. Just right process, cheers

  13. Hmm is anyone else experiencing problems with the pictures on this
    blog loading? I’m trying to find out if its a problem on my end or if it’s the blog.
    Any responses would be greatly appreciated.

  14. You’ve made some good points there. I checked on the net
    for additional information about the issue and
    found most people will go along with your views on this
    web site.

  15. very interesting review. Furthermore visit my very
    own, personal site to have agen slot deposit pulsa. Wonderful web site has received
    acceptance from slot pulsa online gambling establishment men and women in Negara
    sendiri. Certainly, there will be plenty of sophisticated promos if however you join now.

  16. Great weblog right here! Additionally your site rather a lot up
    very fast! What host are you the usage of? Can I
    am getting your affiliate link to your host? I wish my site loaded up as fast as yours lol

  17. 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 quickly as yours lol

  18. Wow that was odd. I just wrote an incredibly long comment but after I clicked
    submit my comment didn’t appear. Grrrr… well I’m not writing all that over again. Anyhow, just wanted to say excellent blog!

  19. Pretty component of content. I simply stumbled upon your site and in accession capital
    to say that I acquire in fact enjoyed account your blog
    posts. Anyway I’ll be subscribing to your augment or even I success you access constantly quickly.

  20. I have been surfing online more than three hours today, yet I never found
    any interesting article like yours. It’s pretty worth
    enough for me. Personally, if all web owners and bloggers made good content as you did, the
    web will be much more useful than ever before.

  21. I have been browsing on-line more than three hours today, yet I never
    found any fascinating article like yours. It’s pretty price sufficient for me.
    In my opinion, if all web owners and bloggers made just right content as you
    probably did, the web will be a lot more helpful than ever before.

Comments are closed.