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

  1. I’ve been surfing online more than 3 hours today, yet I never
    found any interesting article like yours. It’s pretty worth enough for me.
    In my view, if all website owners and bloggers made good content as you did, the web will be much more useful than ever before.

  2. Just wish to say your article is as astounding. The clarity for your submit is simply spectacular and that i can assume you are an expert on this
    subject. Fine along with your permission let me to grasp your feed to stay up to date with approaching post.
    Thanks a million and please continue the enjoyable work.

  3. 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 a number of websites for about a
    year and am worried about switching to another platform.
    I have heard very good things about blogengine.net.
    Is there a way I can import all my wordpress
    posts into it? Any kind of help would be really appreciated!

  4. Hey There. I found your blog using msn. This is
    a really well written article. I’ll be sure to bookmark it and
    return to read more of your useful info. Thanks for the post.
    I will certainly return.

  5. It’s appropriate time to make some plans for the long
    run and it is time to be happy. I have read this post and if
    I may just I want to suggest you some interesting issues or tips.
    Maybe you can write subsequent articles relating to this article.
    I want to learn more things about it!

  6. I’ve been browsing online more than 3 hours
    today, yet I never found any interesting article like yours.
    It’s pretty worth enough for me. Personally, if all webmasters and bloggers made good content as you did, the
    internet will be a lot more useful than ever before.

  7. Please let me know if you’re looking for a author for
    your weblog. You have some really great posts and I
    think I would be a good asset. If you ever want to take some of the load off,
    I’d love to write some material for your blog in exchange for a link back to mine.
    Please blast me an email if interested. Regards!

  8. You are so awesome! I do not believe I have
    read a single thing like that before. So wonderful to find somebody with a few original thoughts on this topic.
    Seriously.. many thanks for starting this up. This site is one thing that is needed on the internet, someone with some originality!

  9. I like the valuable info you provide in your articles.
    I’ll bookmark your blog and check again here frequently.
    I am quite certain I will learn plenty of new
    stuff right here! Best of luck for the next!

  10. Aw, this was a really nice post. Taking a few minutes and actual
    effort to create a really good article… but what can I
    say… I put things off a lot and never seem to get anything done.

  11. I got this website from my friend who informed me regarding
    this web page and at the moment this time I am
    browsing this web page and reading very informative content at this place.

  12. Pretty component to content. I simply stumbled
    upon your blog and in accession capital to claim that I get actually loved account your weblog posts.
    Anyway I’ll be subscribing to your feeds or even I success
    you get entry to persistently fast.

  13. Hi there would you mind sharing which blog platform you’re
    using? I’m looking to start my own blog soon but I’m having a tough time choosing between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your design seems different then most blogs and I’m looking
    for something unique. P.S Sorry for getting off-topic but I had to ask!

  14. Thanks for some other informative web site. The place else could I am getting that type of info written in such an ideal method?
    I’ve a project that I am just now operating on, and I
    have been at the look out for such information.

  15. Oh my goodness! Impressive article dude! Thanks, However I am experiencing troubles with your RSS.
    I don’t understand why I am unable to subscribe to it.
    Is there anybody else getting similar RSS problems? Anybody who
    knows the answer can you kindly respond? Thanx!!

  16. Hello There. I found your blog using msn. This
    is an extremely well written article. I’ll make sure to bookmark it and come
    back to read more of your useful information. Thanks for the post.
    I will definitely return.

  17. Excellent pieces. Keep writing such kind of info on your page.

    Im really impressed by your site.
    Hello there, You’ve done a great job. I’ll certainly
    digg it and in my view suggest to my friends. I’m
    confident they’ll be benefited from this website.

  18. I’m not sure where you are getting your information, but good topic.
    I needs to spend some time learning much more or understanding more.

    Thanks for wonderful info I was looking for this information for my mission.

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

Comments are closed.