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

  1. Hi 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 options for another platform. I would be great if you could
    point me in the direction of a good platform.

  2. Excellent items from you, man. I have take into accout your stuff prior to
    and you’re simply extremely magnificent. I really like what you
    have acquired right here, really like what you’re stating and the way
    in which through which you assert it. You are making it entertaining and you continue
    to take care of to keep it wise. I cant wait to learn far more from
    you. This is really a tremendous web site.

  3. Hello there! I know this is kinda off topic but I was wondering if you knew where I could get a captcha plugin for my comment
    form? I’m using the same blog platform as yours and I’m having trouble finding one?
    Thanks a lot!

  4. I’m really enjoying the design and layout of your site.
    It’s a very easy on the eyes which makes it much more
    pleasant for me to come here and visit more often. Did you hire
    out a designer to create your theme? Great work!

  5. Howdy! This article could not be written any better! Looking
    through this article reminds me of my previous roommate!
    He always kept preaching about this. I most certainly will forward this article to him.
    Fairly certain he’ll have a very good read. Thanks for
    sharing!

  6. constantly i used to read smaller articles which as well
    clear their motive, and that is also happening with this post which I am reading at this
    time.

  7. Someone necessarily help to make significantly posts
    I would state. This is the first time I frequented your web page and thus far?
    I surprised with the analysis you made to create this actual post amazing.
    Magnificent activity!

  8. Hello There. I discovered your weblog the usage of msn. This is a very neatly written article.
    I’ll make sure to bookmark it and return to read extra of your
    helpful information. Thanks for the post. I will certainly return.

  9. I blog often and I seriously thank you for your information. This great article
    has truly peaked my interest. I’m going to book mark your blog and
    keep checking for new information about once a week. I opted in for your
    Feed too.

  10. Hi there! This is my first comment here so I just wanted to give a quick shout out and
    say I genuinely enjoy reading your posts.
    Can you suggest any other blogs/websites/forums that deal
    with the same topics? Thanks a lot!

  11. I’ve been exploring for a little bit for any high quality
    articles or weblog posts on this kind of house . Exploring in Yahoo I eventually stumbled upon this
    website. Studying this info So i’m glad to convey that I have a very just right uncanny
    feeling I discovered exactly what I needed. I so much for sure will make sure to do not fail to remember this web site and provides it
    a look on a continuing basis.

  12. hey there and thank you for your info – I have definitely picked up something new from right here.
    I did however expertise some technical issues using this web site, since I experienced to reload the web site many times previous to I could
    get it to load correctly. I had been wondering if your web host is OK?
    Not that I am complaining, but slow loading instances times will often affect your placement in google and can damage your high-quality score if advertising and marketing with
    Adwords. Well I am adding this RSS to my e-mail and could look out for a
    lot more of your respective intriguing content.
    Ensure that you update this again soon.

  13. Today, I went to the beach front with my children. 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
    put 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
    entirely off topic but I had to tell someone!

  14. I got this website from my buddy who informed me about this web site and at the moment this time I am visiting this web site and
    reading very informative articles at this place.

  15. Greetings from California! I’m bored to death at work so I decided
    to browse your blog on my iphone during lunch break.
    I love the knowledge you present 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, fantastic blog!

  16. The other day, while I was at work, my sister stole my apple ipad and tested to see if
    it can survive a twenty five foot drop, just so she can be
    a youtube sensation. My iPad is now broken and she has 83
    views. I know this is totally off topic but
    I had to share it with someone!

  17. I have read so many articles or reviews on the topic of the blogger lovers
    but this article is really a fastidious piece of writing, keep it up.

  18. This design is wicked! You certainly know how to
    keep a reader amused. Between your wit and your videos, I was
    almost moved to start my own blog (well, almost…HaHa!) Fantastic job.
    I really enjoyed what you had to say, and more than that, how you presented
    it. Too cool!

  19. whoah this blog is excellent i like reading your articles.
    Keep up the great work! You realize, a lot of individuals are searching round
    for this info, you can aid them greatly.

  20. When I initially commented I seem to have clicked on the -Notify me when new
    comments are added- checkbox and now whenever a comment is added I get
    4 emails with the exact same comment. Is there a way you
    can remove me from that service? Cheers!

  21. Great blog! Do you have any suggestions for aspiring writers?
    I’m planning to start my own site soon but I’m a little lost on everything.
    Would you suggest starting with a free platform like WordPress or go for a paid option?
    There are so many options out there that I’m totally overwhelmed
    .. Any tips? Thanks!

  22. Hello! I’ve been reading your weblog for some time now and finally got the bravery to go ahead and give you
    a shout out from Kingwood Tx! Just wanted to say keep up the excellent job!

Comments are closed.