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.

17,247 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. 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 four emails with the same comment.
    Is there any way you can remove people from that service?
    Bless you!

  2. Hello! I realize this is somewhat off-topic however I needed to ask.

    Does managing a well-established blog like
    yours require a lot of work? I am brand new to operating a blog however I do write in my journal daily.

    I’d like to start a blog so I can easily share my personal experience
    and feelings online. Please let me know if you
    have any kind of ideas or tips for new aspiring
    blog owners. Appreciate it!

  3. Howdy just wanted to give you a quick heads up. The words in your article
    seem to be running off the screen in Ie. I’m not sure if this
    is a format issue or something to do with browser compatibility
    but I figured I’d post to let you know. The design and style look great though!
    Hope you get the problem solved soon. Cheers

  4. I have been surfing online more than 3 hours these days,
    yet I by no means found any attention-grabbing article like yours.
    It is lovely price enough for me. In my opinion, if all web owners and bloggers made excellent content material as you probably
    did, the net might be much more helpful than ever before.

  5. Heya! I just wanted to ask if you ever have any issues with
    hackers? My last blog (wordpress) was hacked and I ended up losing many months of hard work due
    to no data backup. Do you have any methods to stop hackers?

  6. Attractive section of content. I just stumbled upon your web site and
    in accession capital to assert that I acquire in fact enjoyed account your blog posts.

    Anyway I’ll be subscribing to your feeds and even I achievement you access consistently quickly.

  7. We’re a group of volunteers and starting a new scheme in our community.
    Your site provided us with valuable info to work on.
    You’ve done an impressive job and our entire community will be grateful to you.

  8. Asking questions are truly fastidious thing if you are not
    understanding anything completely, except this post
    gives nice understanding yet.

  9. Hey there 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 internet browsers
    and both show the same outcome.

  10. Its like you read my mind! You seem to know a lot about this, like you wrote the book in it or something.
    I think that you could do with a few pics to drive the message home a little bit,
    but instead of that, this is fantastic blog.
    An excellent read. I will definitely be back.

  11. Helpful information. Lucky me I discovered your web site by chance,
    and I am stunned why this accident did not came about earlier!
    I bookmarked it.

  12. Link exchange is nothing else however it is just placing the other
    person’s webpage link on your page at appropriate place and other person will also do similar in support of you.

  13. I have been surfing on-line greater than three hours nowadays,
    but I never discovered any attention-grabbing article like yours.
    It is lovely value enough for me. In my view, if all web owners and bloggers
    made just right content as you probably did, the web can be much more useful than ever before.

  14. If some one desires expert view about running a blog after that i advise
    him/her to pay a visit this webpage, Keep up the nice
    work.

  15. Hello, i read your blog from time to time and i own a
    similar one and i was just wondering if you
    get a lot of spam feedback? If so how do you reduce it, any plugin or anything you can advise?
    I get so much lately it’s driving me mad so any support
    is very much appreciated.

  16. Howdy! I’m at work surfing around your blog from my new iphone!
    Just wanted to say I love reading your blog and look forward to all
    your posts! Carry on the great work!

  17. I just like the valuable info you provide to your articles.
    I’ll bookmark your weblog and test again here frequently.

    I am slightly certain I’ll learn many new stuff right right here!

    Best of luck for the following!

  18. Hey there! Do you use Twitter? I’d like to follow you if that would be ok.
    I’m definitely enjoying your blog and look forward to new posts.

  19. Heya! I’m at work browsing your blog from my new iphone 4!
    Just wanted to say I love reading through your blog and look forward to all your posts!
    Keep up the great work!

  20. Appreciating the time and effort you put into your site and detailed information you
    present. It’s good to come across a blog every once in a while that isn’t the same
    outdated rehashed material. Fantastic read! I’ve saved your site and I’m adding your RSS feeds to my Google
    account.

Comments are closed.