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. 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
    site when you could be giving us something informative to read?

  2. Its such as you read my mind! You seem to grasp so much approximately this, such as you wrote the ebook in it
    or something. I believe that you just could do with some % to drive the message
    home a little bit, however instead of that, this is excellent blog.
    An excellent read. I will definitely be back.

  3. Ꮃonderful beɑt ! I wish tto apρrentice while you amend your ѕite, howw could i ssubscribe foг a blog site?
    The accοunt aided me a acceptaЬle deal. I had been tiny bіt
    acquainted off this your broadcast offered
    brigһt clear idea

    My page slot online terbesar dan terpercaya
    (https://wiki-square.win)

  4. Hi there it’s me, I am also visiting this web page regularly, this
    site is truly nice and the viewers are actually sharing good thoughts.

  5. Howdy would you mind letting me know which webhost you’re working with?
    I’ve loaded your blog in 3 completely different browsers and I must say this blog loads a lot
    quicker then most. Can you suggest a good internet hosting provider at
    a reasonable price? Cheers, I appreciate it!

  6. Have you ever considered about adding a little bit
    more than just your articles? I mean, what you say is valuable and all.

    But think about if you added some great
    photos 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 best
    in its field. Superb blog!

  7. Have you ever considered 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 graphics or videos to give your posts more, “pop”!
    Your content is excellent but with images and videos, this blog could undeniably be
    one of the most beneficial in its niche. Amazing blog!

  8. This is the perfect webpage for anybody who hopes to understand this topic.
    You realize a whole lot its almost tough to argue with you (not
    that I personally would want to…HaHa). You certainly put a new spin on a subject that has been discussed for ages.
    Excellent stuff, just excellent!

  9. Hmm is anyone else experiencing problems with the pictures on this blog loading?

    I’m trying to determine if its a problem on my end or if it’s the blog.
    Any feedback would be greatly appreciated.

  10. I’ve been surfing on-line greater than 3 hours these days, yet I never
    found any fascinating article like yours. It’s lovely value sufficient for me.
    In my view, if all web owners and bloggers made
    excellent content material as you did, the internet will probably be much more useful
    than ever before.

  11. Aw, this was an incredibly nice post. Finding the time
    and actual effort to generate a great article… but what can I say… I procrastinate
    a lot and never seem to get anything done.

  12. Wow that was strange. I just wrote an extremely long comment but after I clicked submit my comment didn’t appear.

    Grrrr… well I’m not writing all that over again. Anyway, just wanted to say fantastic blog!

  13. It is appropriate time to make some plans for the longer term and it is time
    to be happy. I have learn this put up and if I could I
    desire to counsel you few fascinating things or advice.
    Perhaps you could write subsequent articles referring to this
    article. I want to learn more issues about it!

  14. The other day, while I was at work, my cousin stole my iphone and tested to see if it can survive a 25 foot drop,
    just so she can be a youtube sensation. My apple ipad is now destroyed and she
    has 83 views. I know this is totally off topic but I had to share it with
    someone!

  15. I’m imprеssed, I must ѕay. Rarely do I come ahross a bloց that’s equaⅼly educative and entertaining,
    and let me tell you, ʏou’ve һit tһе nail on thе head.
    The problеm iѕ an issue that too few folks ɑre speaking intelligently
    about. I am very һappy that I stumbled acrfoss tһis
    during my seaгch for somethіng reցardikng this.

    My web Ƅⅼog slot terbesar

  16. It’s perfect time to make some plans for the long
    run and it’s time to be happy. I’ve learn this submit and if I may just I want to counsel
    you few attention-grabbing things or suggestions.
    Maybe you could write subsequent articles referring to this article.
    I want to read even more issues approximately it!

  17. I am curious to find out what blog system you are using?
    I’m experiencing some minor security issues with my latest
    site and I would like to find something more safe. Do you have any suggestions?

  18. Hi there, i read your blog occasionally and i own a similar one and i was just wondering
    if you get a lot of spam responses? If so how do you
    reduce it, any plugin or anything you can suggest?
    I get so much lately it’s driving me insane so any help is very much
    appreciated.

Comments are closed.