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.

17,247 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. Hey, I think your blog might be having browser compatibility issues.

    When I look at your blog site in Firefox, it looks fine but when opening in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up! Other then that, amazing blog!

  2. I got this web site from my buddy who informed
    me concerning this site and at the moment this time I am
    visiting this web site and reading very informative posts at this time.

  3. Have you ever considered about adding a little bit
    more than just your articles? I mean, what you say is
    important and all. However think about if you added some great images or videos
    to give your posts more, “pop”! Your content is excellent but with images and video clips, this
    site could certainly be one of the very best in its niche.
    Amazing blog!

  4. I loved as much as you will receive carried
    out right here. The sketch is attractive, your authored material stylish.
    nonetheless, you command get got an edginess over that
    you wish be delivering the following. unwell unquestionably
    come more formerly again as exactly the same nearly very often inside case you shield
    this hike.

  5. It’s great that you are getting thoughts from this piece of writing as well
    as from our dialogue made at this time.

  6. When I initially left a comment I appear to have clicked on the -Notify me when new
    comments are added- checkbox and from now on every time a comment is added I get 4 emails with the same comment.

    There has to be a means you are able to remove me from that service?
    Cheers!

  7. Pretty nice post. I just stumbled upon your blog and wanted to say
    that I have truly enjoyed browsing your blog posts. After all I’ll be subscribing to
    your feed and I hope you write again soon!

  8. Pretty section of content. I simply stumbled upon your web site and in accession capital to assert that I get
    in fact loved account your weblog posts. Any way I’ll be subscribing in your augment and even I fulfillment you get admission to constantly quickly.

  9. Hi there to all, how is the whole thing, I think every one is getting more
    from this web site, and your views are pleasant
    in support of new viewers.

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

  11. With havin so much written content do you ever run into any
    problems of plagorism or copyright infringement? My site has a lot of
    exclusive content I’ve either created myself or outsourced but
    it seems a lot of it is popping it up all over the internet without my permission.
    Do you know any methods to help stop content from being stolen? I’d certainly appreciate it.

  12. Good day! I know this is kinda off topic but
    I’d figured I’d ask. Would you be interested in exchanging links or maybe guest authoring a blog post or vice-versa?
    My site covers a lot of the same topics as yours and I think we could greatly benefit
    from each other. If you are interested feel free to send me an e-mail.

    I look forward to hearing from you! Fantastic blog by the way!

  13. It’s appropriate time to make some plans for the
    longer term and it’s time to be happy. I have read this put up and if I could I desire to recommend you some fascinating things or advice.
    Perhaps you can write next articles regarding this article.
    I want to read more issues approximately it!

  14. A person necessarily lend a hand to make significantly articles I’d state.
    This is the very first time I frequented your web page and
    to this point? I surprised with the analysis you made to
    make this actual submit incredible. Wonderful process!

  15. I do not even know how I ended up here, but I thought
    this post was good. I don’t know who you are but definitely you’re going
    to a famous blogger if you are not already 😉 Cheers!

Comments are closed.