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. Today, while I was at work, my cousin stole my apple ipad and tested to see if it
    can survive a thirty foot drop, just so she can be a youtube sensation. My
    iPad is now broken and she has 83 views. I know this is entirely off topic but
    I had to share it with someone!

  2. It’s a shame you don’t have a donate button! I’d most certainly donate to this brilliant
    blog! I suppose for now i’ll settle for book-marking
    and adding your RSS feed to my Google account.
    I look forward to new updates and will share this site
    with my Facebook group. Chat soon!

  3. Hello, i believe that i saw you visited my site thus i came to return the favor?.I’m trying to
    find issues to enhance my site!I suppose its adequate to make
    use of a few of your ideas!!

  4. Great blog! Do you have any tips and hints for aspiring writers?
    I’m hoping to start my own site soon but I’m a little lost on everything.
    Would you propose starting with a free platform like WordPress or go for a
    paid option? There are so many options out there that I’m completely confused ..
    Any recommendations? Bless you!

  5. I’ve been browsing online more than 3 hours today, yet I never found any interesting article
    like yours. It is pretty worth enough for me. In my opinion,
    if all webmasters and bloggers made good content as you did, the internet will be a lot more useful than ever before.

  6. excellent submit, very informative. I ponder why the opposite experts of this sector do not realize
    this. You should proceed your writing. I’m sure, you’ve a huge readers’ base already!

  7. Its such as you read my thoughts! You appear to
    understand a lot about this, such as you wrote the ebook in it or something.

    I feel that you could do with a few % to drive the
    message home a little bit, however other than that, that is great blog.
    A great read. I will definitely be back.

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

  9. It is not my first time to go to see this site, i am visiting
    this web site dailly and get pleasant facts from here all the time.

  10. I’m amazed, I have to admit. Seldom do I encounter
    a blog that’s both equally educative and engaging, and let me tell you, you’ve hit the nail on the head.
    The problem is something that too few folks are
    speaking intelligently about. I am very happy I came across this during my
    search for something relating to this.

  11. Write more, thats all I have to say. Literally, it seems as though you relied on the video to
    make your point. You definitely 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?

  12. It’s truly very difficult in this active life to listen news on TV, thus I simply use internet for that reason, and get the hottest news.

  13. Excellent way of explaining, and fastidious article to get facts on the topic of my
    presentation subject matter, which i am going to
    convey in institution of higher education.

  14. I believe that is among the most vital information for me.
    And i am satisfied reading your article. But should statement on few general things,
    The site taste is perfect, the articles is actually
    excellent : D. Just right job, cheers

  15. Link exchange is nothing else except it is simply
    placing the other person’s blog link on your page at suitable place and
    other person will also do same in favor of you.

  16. If some one wishes expert view on the topic of running a blog then i
    suggest him/her to pay a quick visit this blog, Keep
    up the fastidious work.

  17. You could definitely see your enthusiasm in the work you write.
    The sector hopes for even more passionate writers like you who aren’t afraid to mention how they believe.
    All the time go after your heart.

  18. Hey there, I think your blog might be having browser compatibility issues.
    When I look at your blog in Safari, it looks fine but when opening in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up!
    Other then that, fantastic blog!

  19. I delight in, cause I discovered exactly what I was having a look for.
    You have ended my 4 day long hunt! God Bless you man. Have
    a great day. Bye

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

  21. I do not even know how I stopped up right here, however I
    thought this publish used to be great. I do not know who you might be but certainly you’re going to a well-known blogger if
    you are not already. Cheers!

Comments are closed.