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. 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 some pics to drive
    the message home a little bit, but instead of that, this is fantastic
    blog. A fantastic read. I will certainly be back.

  2. I got this web page from my friend who shared with me concerning this web site
    and at the moment this time I am browsing this site and reading very informative
    articles at this time.

  3. Way cool! Some very valid points! I appreciate you penning this article plus
    the rest of the site is extremely good.

  4. important review. Additionally visit all of our site so
    as to judi slot. The next site has received acceptance from
    slot machine gambling house both males and females in Negara sendiri.
    Presently there are actually a lot of appealing promos
    just in case join at this point.

  5. Hi, I do think this is an excellent web site. I stumbledupon it ;
    ) I will come back once again since I book-marked it.
    Money and freedom is the best way to change, may you be rich and
    continue to guide other people.

  6. Whats up 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 need any coding expertise to make your own blog?
    Any help would be greatly appreciated!

  7. Having read this I believed it was extremely enlightening.
    I appreciate you finding the time and effort to put this
    short article together. I once again find myself spending
    a significant amount of time both reading and posting comments.
    But so what, it was still worth it!

  8. Hey there would you mind letting me know which webhost you’re utilizing?
    I’ve loaded your blog in 3 different browsers and I must say
    this blog loads a lot quicker then most. Can you suggest a good internet
    hosting provider at a reasonable price? Cheers, I appreciate it!

  9. Currently it seems like BlogEngine is the best blogging platform available right now.
    (from what I’ve read) Is that what you are using on your blog?

  10. I like the helpful information you provide in your articles.
    I will bookmark your weblog and check again here regularly.
    I am rather certain I’ll be informed plenty of new stuff
    right here! Best of luck for the following!

  11. I like the valuable info you provide in your articles.
    I will bookmark your weblog and check again here
    frequently. I am quite certain I will learn plenty of new stuff
    right here! Good luck for the next!

  12. Hi there! This is kind of off topic but I need some advice from an established blog.
    Is it very difficult to set up your own blog? I’m not very techincal but I can figure things out pretty fast.
    I’m thinking about setting up my own but I’m not sure where to begin. Do you have any ideas or
    suggestions? Cheers

  13. I like what you guys are usually up too. This type of clever work and exposure!
    Keep up the terrific works guys I’ve you guys to our blogroll.

  14. Its like you read my thoughts! You appear to understand a lot approximately this, such as you wrote the book in it or something.
    I believe that you can do with some % to pressure the message house a little bit, however
    other than that, that is wonderful blog. A fantastic read.
    I’ll definitely be back.

  15. Great weblog here! Additionally your site loads
    up fast! What host are you the use of? Can I am getting your affiliate
    link to your host? I want my web site loaded up as fast as
    yours lol

  16. It is the best time to make a few plans for the long run and it is time to be happy.
    I’ve read this publish and if I may just I want to recommend you some fascinating things or advice.
    Perhaps you could write next articles referring to this article.
    I want to learn even more things about it!

  17. I like the valuable information you supply to your articles.
    I’ll bookmark your weblog and check again here frequently.
    I am somewhat sure I will learn a lot of new stuff right right here!
    Good luck for the next!

  18. Its not my first time to pay a visit this site, i am visiting this web site dailly and get fastidious information from
    here daily.

  19. I am extremely impressed with your writing skills and also with the layout to your weblog.
    Is this a paid topic or did you customize it your self?
    Either way stay up the excellent quality writing, it’s
    rare to see a great weblog like this one these days..

  20. interesting review. In addition visit the perfect site to realize game
    slot online. These pages has received acknowledgement
    from the slot online on line casino members in Indonesia.
    Presently there are usually many wonderful promos in the event that join during this period.

  21. Admiring the dedication you put into your blog and detailed information you provide.
    It’s great to come across a blog every once in a while
    that isn’t the same outdated rehashed material. Wonderful read!
    I’ve bookmarked your site and I’m adding your RSS feeds to my Google account.

  22. After going over a number of the blog posts on your web page, I honestly appreciate your
    way of writing a blog. I added it to my bookmark webpage list and will be checking back soon. Please
    check out my web site too and tell me what you think.

  23. Its such as you learn my mind! You seem to know a lot
    about this, like you wrote the book in it or something.
    I believe that you just can do with a few percent to pressure
    the message house a little bit, however other than that, this is great
    blog. An excellent read. I will certainly be back.

  24. Hmm is anyone else experiencing problems with the images on this
    blog loading? I’m trying to figure out if its a
    problem on my end or if it’s the blog. Any responses would be
    greatly appreciated.

Comments are closed.