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. Its like you read my thoughts! You appear to know a lot approximately this,
    like you wrote the book in it or something.

    I feel that you can do with a few percent to drive the message
    house a bit, however instead of that, that is magnificent blog.
    A great read. I’ll definitely be back.

  2. Valuable information. Fortunate me I discovered your web site by accident, and I am surprised why this
    twist of fate didn’t came about in advance! I bookmarked it.

  3. Hi there! I just wanted to ask if you ever have
    any problems with hackers? My last blog (wordpress) was hacked
    and I ended up losing months of hard work due to no back up.
    Do you have any solutions to stop hackers?

  4. Hi there! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s
    new to me. Nonetheless, I’m definitely happy I found it and I’ll
    be bookmarking and checking back frequently!

  5. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point.
    You clearly know what youre talking about, why throw
    away your intelligence on just posting videos to your site when you could be giving us
    something enlightening to read?

  6. It’s the best time to make some plans for the long run and it
    is time to be happy. I have learn this put up and if I may just
    I want to suggest you few fascinating things or tips.
    Perhaps you could write subsequent articles regarding this article.
    I desire to learn more issues approximately it!

  7. After I originally left a comment I seem to have clicked on the -Notify me when new comments are added- checkbox and from now on every time
    a comment is added I recieve 4 emails with the same comment.
    Perhaps there is a way you can remove me from that service?
    Kudos!

  8. Hi there! This is my first visit to your blog! We are a collection of volunteers and starting a new initiative in a community in the same niche.

    Your blog provided us beneficial information to work on. You have done a marvellous job!

  9. Whoa! This blog looks exactly like my old one! It’s on a completely different subject but it has pretty much the same layout
    and design. Great choice of colors!

  10. Fantastic beat ! I would like to apprentice while you amend your web site, how
    can i subscribe for a blog web site? The account aided me a
    acceptable deal. I had been a little bit acquainted of this
    your broadcast offered bright clear idea

  11. Hello there! I could have sworn I’ve been to this web site before but after going through some of the articles I realized it’s new to
    me. Anyhow, I’m definitely delighted I found it and I’ll be bookmarking it
    and checking back frequently!

  12. Hello just wanted to give you a quick heads up. The
    words in your content seem to be running off the screen in Chrome.
    I’m not sure if this is a format issue or
    something to do with internet browser compatibility but I figured I’d post to let you know.

    The design look great though! Hope you get the problem resolved soon. Kudos

  13. Wow, incredible blog layout! How long have you been blogging for?

    you make blogging look easy. The overall look of your site
    is excellent, let alone the content!

  14. We are a bunch of volunteers and starting a brand new scheme in our community.
    Your web site offered us with useful info to work on. You have done
    an impressive task and our whole community will likely be grateful
    to you.

  15. Heya i am for the primary time here. I found this board and
    I in finding It truly helpful & it helped me out much.
    I hope to give something again and aid others such as
    you aided me.

  16. Wow, fantastic blog layout! How long have you been blogging
    for? you make blogging look easy. The overall look of your
    site is fantastic, let alone the content!

  17. Everyone loves what you guys tend to be up too.
    This type of clever work and reporting! Keep up the good works
    guys I’ve included you guys to blogroll.

  18. you’re in point of fact a excellent webmaster. The web
    site loading pace is amazing. It kind of feels that you’re doing any unique
    trick. In addition, The contents are masterpiece. you have done
    a wonderful task in this subject!

  19. Today, I went to the beachfront 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
    put 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.