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

  1. Hello my loved one! I wish to say that this post is amazing, nice written and include
    almost all vital infos. I’d like to peer extra posts like this .

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

  3. Attractive portion of content. I just stumbled upon your weblog and in accession capital to claim that I get actually enjoyed account your weblog
    posts. Anyway I’ll be subscribing for your feeds and even I
    achievement you get right of entry to constantly
    rapidly.

  4. Hey there! This is my first visit to your blog!
    We are a group of volunteers and starting a new project in a community in the same niche.
    Your blog provided us useful information to work on. You have done a wonderful job!

  5. This is very interesting, You are a very skilled blogger.
    I’ve joined your feed and look forward to seeking more
    of your fantastic post. Also, I have shared your web site in my social networks!

  6. A motivating discussion is definitely worth comment. I do believe that you ought to publish more on this
    subject, it might not be a taboo subject but generally people don’t speak about these issues.
    To the next! Cheers!!

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

  8. It’s amazing to visit this site and reading the views of all colleagues regarding this article,
    while I am also eager of getting experience.

  9. Having read this I thought it was rather informative.
    I appreciate you spending some time and effort to
    put this article together. I once again find
    myself personally spending a significant amount of time both reading and leaving comments.

    But so what, it was still worthwhile!

  10. I’m amazed, I have to admit. Rarely do I encounter a
    blog that’s equally educative and entertaining, and without a doubt, you have hit the nail
    on the head. The issue is something which not enough people are speaking
    intelligently about. I am very happy I stumbled across
    this during my search for something relating to this.

  11. Heya i am for the primary time here. I found this board and I to find It truly helpful & it helped me out a
    lot. I hope to offer something back and
    help others such as you aided me.

  12. Hi there would you mind letting me know which web host
    you’re using? I’ve loaded your blog in 3 completely different browsers and I must say this blog loads
    a lot quicker then most. Can you suggest a good internet
    hosting provider at a fair price? Kudos, I
    appreciate it!

  13. Hey there! I just wanted to ask if you ever have
    any problems with hackers? My last blog (wordpress)
    was hacked and I ended up losing a few months of hard work
    due to no backup. Do you have any methods to prevent
    hackers?

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

  15. I just like the helpful info you supply on your articles.
    I’ll bookmark your blog and take a look at once more right here regularly.
    I am quite certain I will be told many new stuff proper right here!

    Best of luck for the following!

  16. What’s Happening i’m new to this, I stumbled upon this I’ve
    discovered It absolutely useful and it has aided me out
    loads. I hope to contribute & help different users like its helped me.
    Great job.

  17. I am extremely impressed with your writing skills as well as with the
    layout on your blog. Is this a paid theme
    or did you modify it yourself? Anyway keep up the excellent quality writing, it is rare to see
    a nice blog like this one these days.

  18. Howdy! 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! Carry on the outstanding work!

  19. Hi would you mind letting me know which web host you’re using?
    I’ve loaded your blog in 3 completely different internet browsers and I must say this blog loads a lot faster then most.
    Can you recommend a good web hosting provider at a fair price?
    Kudos, I appreciate it!

  20. 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 blog
    when you could be giving us something enlightening to read?

  21. Hiya! I know this is kinda off topic but I’d figured I’d
    ask. Would you be interested in exchanging links or maybe
    guest authoring a blog article or vice-versa?
    My blog addresses a lot of the same topics as yours and I believe we could greatly benefit from each other.
    If you are interested feel free to send me an email. I look
    forward to hearing from you! Great blog by the way!

  22. Currently it seems like Movable Type is the best blogging platform out
    there right now. (from what I’ve read) Is that what you’re using on your
    blog?

Comments are closed.