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. 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 feed-back would be greatly appreciated.

  2. If some one wishes to be updated with most recent technologies then he must be pay a
    quick visit this web page and be up to date everyday.

  3. Hello, i feel that i noticed you visited my site thus i got here to return the want?.I’m attempting to in finding issues to improve my site!I
    assume its good enough to make use of a few of your ideas!!

  4. I’m impressed, I have to admit. Seldom do I encounter a blog that’s equally
    educative and entertaining, and without a doubt, you have hit
    the nail on the head. The problem is something which
    not enough men and women are speaking intelligently about.

    Now i’m very happy that I stumbled across this during my search for something concerning this.

  5. I’m amazed, I must say. Rarely do I come across a blog
    that’s both equally educative and engaging, and let me tell you, you’ve hit
    the nail on the head. The issue is something not enough people are speaking intelligently about.
    I’m very happy that I came across this in my search for something relating to this.

  6. What i don’t realize is actually how you’re no longer actually a lot more smartly-liked than you may be right now.
    You’re very intelligent. You already know therefore considerably relating to this topic, produced me personally consider it from a lot of various angles.
    Its like men and women aren’t involved unless it’s something to accomplish with
    Lady gaga! Your own stuffs excellent. All the time deal with it up!

  7. Hello! I’ve been reading your blog for some time now and finally got the courage to go ahead and give you a
    shout out from Humble Texas! Just wanted to tell you keep up the
    excellent work!

  8. whoah this blog is great i like studying your articles.
    Keep up the good work! You know, lots of persons are hunting
    around for this information, you could aid
    them greatly.

  9. It is appropriate time to make some plans for the
    longer term and it’s time to be happy. I have learn this post and if I may just I wish to counsel you some attention-grabbing
    issues or advice. Perhaps you could write subsequent articles regarding this article.
    I desire to learn more issues about it!

  10. Today, I went to the beach front with my kids. I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She
    put the shell to her ear and screamed. There was a hermit
    crab inside and it pinched her ear. She never wants to go back!
    LoL I know this is totally off topic but I had to tell someone!

  11. Have you ever thought about adding a little bit more than just your articles?

    I mean, what you say is fundamental and all.

    However imagine 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 very best in its
    field. Great blog!

  12. It’s in fact very difficult in this busy life to listen news on Television,
    thus I just use internet for that purpose, and obtain the newest news.

  13. Link exchange is nothing else however it is simply placing the other person’s
    weblog link on your page at proper place and other person will also do similar in support of you.

  14. Its like you read my mind! You appear to know
    so much about this, like you wrote the book in it or something.

    I think that you can do with a few pics to drive the message home a bit, but instead of that, this is fantastic blog.
    A fantastic read. I’ll certainly be back.

  15. I loved as much as you’ll receive carried out right here.
    The sketch is attractive, your authored subject matter stylish.
    nonetheless, you command get got an nervousness over that you wish be
    delivering the following. unwell unquestionably come more formerly again as exactly the
    same nearly a lot often inside case you shield this hike.

  16. Everyone loves what you guys are up too. This kind of
    clever work and coverage! Keep up the amazing works guys
    I’ve incorporated you guys to blogroll.

  17. Hi, I do think this is a great blog. I stumbledupon it 😉 I’m going to come back once again since I book marked it.

    Money and freedom is the greatest way to change, may you be rich and
    continue to help other people.

  18. Great beat ! I would like to apprentice whilst you amend your site, how can i subscribe for
    a weblog site? The account helped me a applicable deal. I had been a little bit familiar of this your broadcast offered vibrant clear concept

  19. I’m gone to inform my little brother, that he should also pay a quick visit this web site on regular basis to obtain updated from hottest news update.

  20. It’s actually very difficult in this busy life to listen news on Television, so I
    only use web for that reason, and take the hottest news.

  21. It’s a shame you don’t have a donate button! I’d most
    certainly donate to this outstanding 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
    talk about this site with my Facebook group. Chat soon!

  22. It’s going to be finish of mine day, but before finish I am reading this enormous paragraph to
    improve my knowledge.

Comments are closed.