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. Greetings from Ohio! I’m bored to death at work so I decided
    to browse your site on my iphone during lunch break. I enjoy the information you provide here and
    can’t wait to take a look when I get home. I’m shocked
    at how fast your blog loaded on my mobile ..
    I’m not even using WIFI, just 3G .. Anyways, good blog!

  2. You could certainly see your skills in the article you write.
    The sector hopes for even more passionate writers like you who are not afraid to say how they believe.
    At all times go after your heart.

  3. I am extremely impressed with your writing talents as smartly as with the layout to your weblog.
    Is that this a paid topic or did you customize it yourself?

    Anyway keep up the excellent high quality writing, it is uncommon to see a
    nice weblog like this one these days..

  4. It’s perfect time to make some plans for the long run and it’s time to be happy.
    I’ve read this put up and if I may just I want to suggest
    you some interesting things or tips. Maybe you could
    write subsequent articles referring to this article.

    I wish to learn more things approximately it!

  5. The other day, while I was at work, my sister stole my iPad and tested to see if it can survive a forty foot
    drop, just so she can be a youtube sensation. My iPad is now destroyed and she has 83 views.

    I know this is completely off topic but I had to share it with
    someone!

  6. Hmm it appears like your site ate my first comment (it was super
    long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly
    enjoying your blog. I as well am an aspiring blog blogger but I’m still new to the whole thing.
    Do you have any suggestions for novice blog writers? I’d
    certainly appreciate it.

  7. I’m gone to say to my little brother, that he should also go
    to see this weblog on regular basis to obtain updated from most up-to-date reports.

  8. Asking questions are truly fastidious thing if you are not understanding anything entirely, except this paragraph provides good understanding even.

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

  10. It’s a pity you don’t have a donate button! I’d definitely donate to this brilliant blog!
    I guess 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 share this site with my Facebook group. Talk soon!

  11. Howdy! This is my first visit to your blog! We are a group of volunteers and starting a new
    initiative in a community in the same niche.
    Your blog provided us valuable information to work on. You have
    done a marvellous job!

  12. Hi, I do believe this is an excellent blog. I
    stumbledupon it 😉 I am going to come back once again since i have book-marked it.
    Money and freedom is the best way to change, may you be rich and continue to guide other people.

  13. Hello there! This is kind of off topic but I need some advice from an established blog.

    Is it hard to set up your own blog? I’m not very techincal but I
    can figure things out pretty quick. I’m thinking about
    making my own but I’m not sure where to start.
    Do you have any ideas or suggestions? Appreciate it

  14. What’s Happening i’m new to this, I stumbled upon this I have found
    It absolutely helpful and it has helped me out loads. I am hoping to give a contribution & aid
    different customers like its helped me. Good job.

  15. Having read this I thought it was very enlightening. I appreciate you taking the time and energy to put this short article together.

    I once again find myself spending a lot of
    time both reading and leaving comments. But so what, it was still worthwhile!

  16. It’s a pity you don’t have a donate button! I’d most certainly donate to this outstanding blog!
    I guess for now i’ll settle for bookmarking and adding your RSS feed
    to my Google account. I look forward to brand new updates and will
    share this site with my Facebook group. Chat soon!

  17. Howdy! I could have sworn I’ve been to this
    site before but after browsing through some of the post I realized it’s new
    to me. Anyways, I’m definitely glad I found it and I’ll
    be bookmarking and checking back often!

  18. Today, I went to the beach 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 placed 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 completely off
    topic but I had to tell someone!

  19. Pretty section of content. I just stumbled upon your blog 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.

Comments are closed.