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. Valuable info. Lucky me I found your web site by chance, and I’m
    surprised why this accident did not happened earlier!
    I bookmarked it.

  2. Excellent blog here! Also your site loads up very
    fast! What host are you using? Can I get your affiliate link
    to your host? I wish my web site loaded up as quickly
    as yours lol

  3. When I initially commented I clicked the “Notify me when new comments are added” checkbox
    and now each time a comment is added I get several
    emails with the same comment. Is there any way you can remove me from that service?
    Bless you!

  4. Have you ever considered about including a little
    bit more than just your articles? I mean, what you say is important and all.
    Nevertheless think of if you added some great pictures or videos to give
    your posts more, “pop”! Your content is excellent but with images and clips, this site could certainly be
    one of the greatest in its niche. Amazing blog!

  5. Attractive section of content. I just stumbled upon your web site and in accession capital to assert that I get actually enjoyed
    account your blog posts. Anyway I will be subscribing to your augment and even I achievement you access consistently fast.

  6. Hello just wanted to give you a brief heads up and let you know a few of the
    images aren’t loading properly. I’m not sure why but I think
    its a linking issue. I’ve tried it in two different web browsers and both show the same outcome.

  7. My relatives all the time say that I am wasting my time here at net, however I know
    I am getting knowledge all the time by reading thes nice content.

  8. Its like you read my mind! You appear to know a lot about this, like you wrote the book in it or something.

    I think that you can do with some pics to drive the message home a bit, but other than that,
    this is wonderful blog. An excellent read. I
    will certainly be back.

  9. I loved as much as you will receive carried out right here.
    The sketch is tasteful, your authored subject matter stylish.
    nonetheless, you command get bought an impatience
    over that you wish be delivering the following. unwell unquestionably come more formerly again as exactly the same nearly very often inside
    case you shield this hike.

  10. Hi there, You’ve done a great job. I will certainly digg it and personally
    suggest to my friends. I’m sure they will be benefited from this site.

  11. I have been exploring for a little for any high-quality articles or weblog posts on this kind of space .
    Exploring in Yahoo I at last stumbled upon this site.
    Studying this info So i am satisfied to express
    that I’ve an incredibly just right uncanny feeling I came upon exactly what I needed.
    I so much no doubt will make sure to don?t omit this
    web site and give it a glance on a relentless basis.

  12. If some one wishes to be updated with hottest technologies therefore he
    must be visit this site and be up to date everyday.

  13. Hello, i feel that i saw you visited my web site thus i came to return the prefer?.I am trying to find things to enhance my web site!I assume its good enough to use some
    of your concepts!!

  14. 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?

  15. Pretty section of content. I just stumbled upon your blog and in accession capital to assert that I acquire
    actually enjoyed account your blog posts. Any way I’ll be subscribing to your augment and even I achievement you access consistently quickly.

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

  17. I’m amazed, I must say. Rarely do I encounter a blog that’s both educative and interesting, and let me
    tell you, you have hit the nail on the head. The issue is something which not enough people are
    speaking intelligently about. I’m very happy that I came
    across this during my search for something regarding this.

  18. Hi there are using WordPress for your blog platform? I’m
    new to the blog world but I’m trying to get started and create
    my own. Do you require any html coding expertise to make your own blog?
    Any help would be greatly appreciated!

  19. This is the right blog for everyone who wants to understand this topic.
    You realize so much its almost hard to argue with you (not that I actually will need to…HaHa).
    You certainly put a brand new spin on a topic that has been discussed for many years.
    Excellent stuff, just great!

  20. Hi there all, here every one is sharing these familiarity,
    thus it’s fastidious to read this webpage, and I used to visit this webpage daily.

Comments are closed.