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,220 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. You can definitely see your skills in the work you write.

    The sector hopes for even more passionate writers like you who aren’t afraid
    to say how they believe. At all times follow your heart.

  2. We stumbled over here by a different web address and
    thought I might as well check things out. I like what I see so now i am following you.
    Look forward to going over your web page repeatedly.

  3. Hey there just wanted to give you a quick 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.

  4. I’m amazed, I have to admit. Seldom do I come across a
    blog that’s equally educative and entertaining, and let me tell you, you’ve hit the nail on the head.
    The problem is something not enough men and women are speaking
    intelligently about. I am very happy I stumbled across this in my search for something concerning this.

  5. Hey there! I know this is kinda off topic but I was wondering which blog platform are you using for this site?
    I’m getting fed up of WordPress because I’ve had
    problems with hackers and I’m looking at alternatives for another platform.

    I would be awesome if you could point me in the direction of a good platform.

  6. I’m impressed, I must say. Seldom do I encounter a blog that’s both equally educative and interesting, and without a doubt,
    you have hit the nail on the head. The issue is something
    that too few men and women are speaking intelligently about.
    I’m very happy I came across this in my hunt for something concerning this.

  7. Does your site have a contact page? I’m having problems locating it
    but, I’d like to shoot you an e-mail. I’ve got some creative ideas for your blog you might be interested
    in hearing. Either way, great website and I look forward to
    seeing it improve over time.

  8. What’s up, always i used to check blog posts here early
    in the morning, as i like to find out more and more.

  9. Oh my goodness! Awesome article dude! Thank you so much, However I am encountering troubles with
    your RSS. I don’t understand the reason why I cannot
    join it. Is there anybody getting similar RSS problems?
    Anyone who knows the answer can you kindly respond?
    Thanx!!

  10. I don’t even know how I ended up here, but I thought this post was good.
    I don’t know who you are but certainly you are going to a famous
    blogger if you are not already 😉 Cheers!

  11. 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 bought an edginess 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.

Comments are closed.