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

  1. Oh my goodness! Amazing article dude! Many thanks, However I am having issues with your RSS.
    I don’t understand why I cannot subscribe to it. Is there anybody
    else getting identical RSS issues? Anybody who knows the answer will you kindly respond?
    Thanks!!

  2. Thanks for finally talking about > Contoh Soal Pemrograman –
    Pola Segitiga Siku-siku – Umar faisol < Loved it!

  3. Hi there would you mind sharing which blog platform
    you’re using? I’m planning to start my own blog soon but I’m having a tough time selecting between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your layout seems different then most blogs and I’m looking for something unique.

    P.S Sorry for being off-topic but I had to ask!

  4. I like the valuable information you provide
    in your articles. I’ll bookmark your weblog and check again here
    regularly. I am quite sure I’ll learn a lot of new stuff right
    here! Good luck for the next!

  5. It’s perfect time to make some plans for the future and it is time to be happy.
    I’ve read this post and if I could I want to suggest
    you few interesting things or advice. Perhaps you could write next articles referring to this article.

    I desire to read more things about it!

  6. I love your blog.. very nice colors & theme. Did you make this website yourself or did you hire someone to do it for you?
    Plz answer back as I’m looking to construct my own blog and would like to know where u got this
    from. thanks a lot

  7. Hey there! Would you mind if I share your blog with my zynga group?
    There’s a lot of folks that I think would really enjoy your content.
    Please let me know. Cheers

  8. Simply wish to say your article is as surprising. The clarity to your publish
    is simply nice and that i could assume you are knowledgeable on this subject.
    Fine together with your permission let me to grasp your feed to stay
    updated with impending post. Thanks 1,000,000 and please continue the enjoyable work.

  9. I love your blog.. very nice colors & theme. Did you create this website yourself
    or did you hire someone to do it for you? Plz reply as I’m looking to create my own blog and would like
    to know where u got this from. thanks

  10. Magnificent goods from you, man. I have understand your stuff previous to and
    you are just too magnificent. I really like what you’ve acquired here,
    really like what you are stating and the way in which you say it.

    You make it entertaining and you still take care of to keep it wise.
    I can not wait to read much more from you. This is really a wonderful
    web site.

  11. We are a group of volunteers and opening a new scheme in our community.
    Your website provided us with valuable information to work on. You have done a formidable job and our entire community will be thankful to you.

  12. My developer is trying to persuade me to move to .net from PHP.
    I have always disliked the idea because of the expenses.
    But he’s tryiong none the less. I’ve been using Movable-type on numerous websites for
    about a year and am worried about switching to another platform.
    I have heard great things about blogengine.net. Is
    there a way I can import all my wordpress content into it?
    Any kind of help would be greatly appreciated!

  13. An outstanding share! I’ve just forwarded this onto
    a friend who had been doing a little homework on this.
    And he actually ordered me breakfast because I
    discovered it for him… lol. So allow me to reword this….
    Thank YOU for the meal!! But yeah, thanks for spending some time to discuss this matter here
    on your web site.

  14. Hello there, You’ve done a great job. I’ll certainly digg it and personally suggest to
    my friends. I’m sure they will be benefited from
    this web site.

  15. I know this if off topic but I’m looking into starting my own weblog and was wondering what all is required to get setup?
    I’m assuming having a blog like yours would cost a pretty
    penny? I’m not very web savvy so I’m not 100% sure. Any recommendations
    or advice would be greatly appreciated. Cheers

Comments are closed.