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.

48,219 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. I need to to thank you for this very good read!!
    I absolutely enjoyed every bit of it. I have you book-marked to look at new things you post…

  2. Pretty nice post. I just stumbled upon your weblog and wished to say that
    I have really enjoyed browsing your blog posts.

    In any case I’ll be subscribing to your feed and I hope
    you write again very soon!

  3. Simply desire to say your article is as astounding.
    The clearness in your post is simply cool and i could assume you’re an expert on this subject.

    Fine with your permission let me to grab your feed to keep updated with forthcoming post.
    Thanks a million and please keep up the rewarding work.

  4. This is the perfect website for anybody who wishes to find out about this topic.
    You know a whole lot its almost hard to argue with you
    (not that I actually will need to…HaHa). You definitely
    put a new spin on a topic that’s been written about for ages.
    Great stuff, just great!

  5. This page definitely has all the information I wanted
    about this subject and didn’t know who to ask.

  6. I pay a quick visit everyday a few websites
    and information sites to read articles or reviews, however this website provides feature based articles.

  7. I’m not sure why but this blog is loading extremely slow for me.
    Is anyone else having this problem or is it a problem on my end?
    I’ll check back later and see if the problem still exists.

  8. Thanks for some other informative website. The place else
    could I am getting that type of info written in such a perfect manner?
    I have a mission that I am just now running on, and I have been on the glance
    out for such information.

  9. When someone writes an article he/she maintains the thought of a user in his/her brain that how a user
    can be aware of it. So that’s why this piece of
    writing is amazing. Thanks!

  10. Thanks for some other informative site. The place else could I
    get that type of information written in such an ideal means?

    I’ve a project that I’m simply now running on, and I’ve been on the look out for such info.

  11. Hello! I know this is somewhat off topic but I was wondering if you knew where I could get a captcha plugin for my comment form?

    I’m using the same blog platform as yours and I’m having difficulty finding one?
    Thanks a lot!

  12. Good post however I was wondering if you could write a litte more on this topic?
    I’d be very grateful if you could elaborate a little bit more.

    Thanks!

  13. Hello There. I found your blog the usage of msn. This is a really smartly
    written article. I will be sure to bookmark it and come back to read
    more of your helpful info. Thank you for the post. I’ll certainly comeback.

  14. Asking questions are genuinely nice thing if you are not understanding
    anything totally, however this piece of writing offers good understanding even.

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

  16. Hi there! This post couldn’t be written any better!
    Reading this post reminds me of my good old room mate!
    He always kept talking about this. I will forward this write-up to him.
    Fairly certain he will have a good read. Thank you for sharing!

  17. Hi! I could have sworn I’ve been to this website before but after browsing through a few of the posts I realized it’s new to me.
    Anyways, I’m certainly delighted I discovered it and I’ll be bookmarking it and checking back regularly!

  18. Hello there, just became alert to your blog through Google, and
    found that it’s truly informative. I’m going
    to watch out for brussels. I’ll be grateful if you continue
    this in future. Numerous people will be benefited from your
    writing. Cheers!

  19. Hi there it’s me, I am also visiting this site on a regular basis, this
    web site is really pleasant and the people are actually sharing fastidious
    thoughts.

  20. Fantastic beat ! I would like to apprentice while you amend your web
    site, how can i subscribe for a blog site? The account helped me a acceptable deal.
    I had been tiny bit acquainted of this your broadcast provided bright clear idea

  21. My spouse and I stumbled over here from a different web page and thought I might as well check
    things out. I like what I see so i am just following
    you. Look forward to looking into your web page repeatedly.

Comments are closed.