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. Hey there! This is kind of off topic but I need some guidance 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 points or suggestions?
    With thanks

  2. My partner and I stumbled over here different website and thought I might as well check things out.

    I like what I see so i am just following you. Look forward to looking at your web page yet again.

  3. Hi there! Someone in my Facebook group shared this site with us so
    I came to give it a look. I’m definitely enjoying the information. I’m bookmarking and will
    be tweeting this to my followers! Wonderful blog
    and outstanding style and design.

  4. With havin so much content and articles do you ever run into any problems of plagorism or copyright
    infringement? My website has a lot of unique
    content I’ve either created myself or outsourced but it appears a lot of it is popping it up all over the web without
    my agreement. Do you know any ways to help prevent content from being stolen? I’d
    definitely appreciate it.

  5. Hmm it appears like your website ate my first comment (it was super long) so I guess I’ll just sum
    it up what I submitted and say, I’m thoroughly enjoying your blog.
    I too am an aspiring blog blogger but I’m still new to everything.
    Do you have any tips for newbie blog writers? I’d really appreciate it.

  6. We’re a group of volunteers and opening a new scheme in our community.
    Your website provided us with valuable info to work on. You have done a formidable job and our whole community will
    be thankful to you.

  7. I have been exploring for a little for any high quality
    articles or blog posts in this kind of area .
    Exploring in Yahoo I finally stumbled upon this web site.
    Reading this information So i’m happy to show that I have a
    very just right uncanny feeling I discovered exactly what I needed.
    I so much undoubtedly will make sure to do not forget this site and give it a
    glance on a constant basis.

  8. Hi there to every body, it’s my first pay a visit of this blog; this web site includes awesome and actually excellent stuff in favor of visitors.

  9. When I originally left a comment I seem to have clicked the -Notify me when new comments
    are added- checkbox and now whenever a comment is added I get four emails
    with the exact same comment. Perhaps there
    is a way you are able to remove me from that service? Kudos!

  10. Howdy, I think your web site may be having internet browser compatibility problems.

    Whenever I look at your website in Safari, it looks
    fine however, if opening in I.E., it’s got some overlapping issues.
    I merely wanted to give you a quick heads up! Besides that, wonderful blog!

  11. Heya are using WordPress for your blog platform?

    I’m new to the blog world but I’m trying to get started and set up my own. Do
    you require any coding expertise to make your own blog? Any help would be really appreciated!

  12. I think this is among the most significant info for me.
    And i’m glad reading your article. But should remark on few general things, The site style is wonderful, the articles
    is really nice : D. Good job, cheers

  13. I was suggested this blog through my cousin. I’m not sure whether this post
    is written by way of him as no one else recognize such distinctive
    approximately my difficulty. You are incredible! Thank you!

  14. Wow that was unusual. I just wrote an incredibly long comment
    but after I clicked submit my comment didn’t show up.

    Grrrr… well I’m not writing all that over again. Anyhow, just wanted
    to say superb blog!

  15. Ahaa, its good discussion concerning this article at this place at this blog,
    I have read all that, so at this time me also commenting at this place.

  16. Hi, i read your blog occasionally and i own a similar one and i was just
    wondering if you get a lot of spam comments? If so how do
    you reduce it, any plugin or anything you can suggest? I get so much
    lately it’s driving me insane so any support is very much appreciated.

  17. I know this if off topic but I’m looking into starting my own blog and was wondering what all is
    required to get set up? I’m assuming having a blog like yours would cost a
    pretty penny? I’m not very web smart so I’m not 100% sure.

    Any tips or advice would be greatly appreciated.
    Thank you

  18. I’m more than happy to find this website. I want to to thank you for
    your time for this particularly fantastic read!!
    I definitely savored every part of it and I have you saved as a favorite to check out new information on your website.

Comments are closed.