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. 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 waste your intelligence on just posting videos to your blog when you could be giving us something informative to
    read?

  2. Howdy just wanted to give you a quick heads up.
    The words in your post seem to be running off the screen in Opera.
    I’m not sure if this is a format issue or something to do with browser compatibility but I figured I’d post to let you
    know. The style and design look great though! Hope you get the issue resolved soon. Kudos

  3. It’s perfect time to make some plans for the long run and it’s time
    to be happy. I’ve learn this post and if I may just I want to recommend you few interesting issues or
    tips. Perhaps you can write subsequent articles relating to this article.
    I desire to learn more things about it!

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

  5. Hello there, You’ve done an incredible job.
    I’ll certainly digg it and personally recommend to my friends.
    I’m confident they’ll be benefited from this site.

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

  7. You ought to be a part of a contest for one of the finest sites online.
    I am going to highly recommend this site!

  8. Good way of explaining, and nice post to obtain facts on the topic
    of my presentation subject matter, which i am going to deliver in school.

  9. You can definitely see your enthusiasm within the article you write.
    The sector hopes for even more passionate writers like you who are not afraid
    to mention how they believe. All the time follow your heart.

  10. Greetings from Colorado! I’m bored to death at work so I decided to check
    out your site on my iphone during lunch break. I enjoy the knowledge you provide here and can’t wait to take a look when I get home.
    I’m shocked at how quick your blog loaded on my cell phone ..
    I’m not even using WIFI, just 3G .. Anyhow,
    great site!

  11. Link exchange is nothing else however it is only placing the other person’s
    webpage link on your page at proper place and other person will
    also do same for you.

  12. naturally like your web site however you need to check the spelling on several of your posts.
    A number of them are rife with spelling problems and I to find
    it very troublesome to inform the reality on the other hand I’ll surely come
    again again.

  13. I think that what you said made a great deal of sense.

    But, think about this, what if you were to write a killer title?

    I ain’t suggesting your information is not solid., however what if
    you added a post title that makes people want more? I mean Contoh Soal Pemrograman –
    Pola Segitiga Siku-siku – Umar faisol is kinda plain.
    You ought to glance at Yahoo’s front page and note how they create news titles to get viewers to open the links.
    You might try adding a video or a picture or two to get people interested about what you’ve got to say.
    In my opinion, it would make your blog a little livelier.

  14. 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 article or vice-versa? My blog discusses
    a lot of the same subjects as yours and I feel we could greatly
    benefit from each other. If you’re interested feel free to
    shoot me an e-mail. I look forward to hearing from you! Excellent
    blog by the way!

  15. Very nice post. I just stumbled upon your weblog and wanted to say
    that I’ve truly enjoyed browsing your blog posts.
    In any case I will be subscribing to your rss feed
    and I hope you write again soon!

  16. I don’t even know how I finished up here, but I assumed this put up was once great.
    I do not understand who you might be however certainly you’re going to
    a well-known blogger in the event you are not already. Cheers!

  17. Today, while I was at work, my cousin stole my apple ipad and tested
    to see if it can survive a twenty five foot drop, just so she can be a youtube
    sensation. My apple ipad is now broken and she has 83 views.
    I know this is completely off topic but I had to share it with someone!

  18. I know this web site offers quality depending articles
    or reviews and other material, is there any other web site
    which provides such information in quality?

Comments are closed.