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.

16,626 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. Aw, this was an incredibly nice post. Spending some time and actual effort to make a great article… but what can I say… I hesitate a whole lot and never manage to get nearly anything
    done.

  2. Hmm is anyone else experiencing problems with the pictures on this blog loading?
    I’m trying to determine if its a problem on my end or if it’s the blog.
    Any responses would be greatly appreciated.

  3. Greetings! I’ve been following your web site for a long time now and finally got the bravery to
    go ahead and give you a shout out from Huffman Texas!
    Just wanted to mention keep up the good work!

  4. Howdy just wanted to give you a quick heads up.
    The text in your article seem to be running off the
    screen in Chrome. I’m not sure if this is a formatting issue or something to do with web browser compatibility but I figured I’d post to let you know.

    The design and style look great though! Hope you get the issue fixed soon. Kudos

  5. Having read this I thought it was very informative. I appreciate you taking the time
    and energy 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 worth it!

  6. Hi there just wanted to give you a quick heads up.
    The words in your post seem to be running off the screen in Safari.

    I’m not sure if this is a formatting issue or something to do with browser compatibility but
    I figured I’d post to let you know. The design look great though!
    Hope you get the problem solved soon. Cheers

  7. Excellent blog here! Also your site loads up very fast!

    What host are you using? Can I get your affiliate link to your
    host? I wish my web site loaded up as fast as yours lol

  8. After I initially left a comment I seem to have clicked the -Notify me when new comments are added- checkbox and
    from now on every time a comment is added I receive 4
    emails with the exact same comment. There has to be an easy method you can remove me
    from that service? Appreciate it!

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

  10. Greetings from Idaho! I’m bored to death at work so
    I decided to browse your site on my iphone during lunch break.

    I love the info you provide here and can’t wait to take a look
    when I get home. I’m shocked at how fast your blog
    loaded on my phone .. I’m not even using WIFI, just 3G ..
    Anyhow, good site!

  11. Does your blog have a contact page? I’m having trouble locating it but, I’d like to shoot
    you an e-mail. I’ve got some recommendations for your blog you might be interested in hearing.

    Either way, great site and I look forward to seeing
    it grow over time.

  12. Does your blog have a contact page? I’m having trouble locating it but, I’d like to send you an e-mail.

    I’ve got some creative ideas for your blog you might be interested in hearing.
    Either way, great blog and I look forward to seeing it develop
    over time.

  13. I think that everything composed was actually very logical.
    But, what about this? what if you were to write a killer title?
    I am not suggesting your information isn’t good, however suppose you added something to possibly get a person’s attention? I mean Contoh Soal Pemrograman –
    Pola Segitiga Siku-siku – Umar faisol is kinda boring.
    You could glance at Yahoo’s front page and watch how they create
    post headlines to get viewers interested. You might add a video or a
    related picture or two to grab readers interested about what
    you’ve written. Just my opinion, it could make your blog a little livelier.

  14. I’ve been exploring for a little bit for any high-quality articles or weblog posts in this
    sort of area . Exploring in Yahoo I at last stumbled upon this web site.
    Studying this information So i’m satisfied to show that I have a very just right uncanny feeling I
    discovered exactly what I needed. I most no doubt will
    make sure to don?t disregard this web site and give it a glance regularly.

  15. Appreciating the commitment you put into your site
    and in depth information you present. It’s good to come
    across a blog every once in a while that isn’t the
    same out of date rehashed material. Fantastic read!
    I’ve bookmarked your site and I’m including your RSS feeds to my Google
    account.

Comments are closed.