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

  1. Howdy! I could have sworn I’ve visited your blog before but after browsing through a few of the posts
    I realized it’s new to me. Anyways, I’m certainly happy I found it and I’ll be bookmarking it and checking back frequently!

  2. Hi! Do you use Twitter? I’d like to follow you if that would be okay.

    I’m absolutely enjoying your blog and look forward to new updates.

  3. Today, I went to the beach with my children. 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 totally off topic but
    I had to tell someone!

  4. continuously i used to read smaller articles which as well clear their motive, and
    that is also happening with this article which I am reading at this place.

  5. Howdy, i read your blog from time to time and i own a similar one and i was just curious if you get a lot of spam feedback?
    If so how do you prevent it, any plugin or anything you can advise?
    I get so much lately it’s driving me mad so any assistance is
    very much appreciated.

  6. 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 increase.

  7. 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. Personally, if all webmasters and bloggers made
    good content as you did, the web will be much more useful than ever before.

  8. Hey! I just wanted to ask if you ever have
    any problems with hackers? My last blog (wordpress) was hacked and I ended up losing
    many months of hard work due to no backup. Do you have any solutions to protect against hackers?

  9. Have you ever considered about adding a
    little bit more than just your articles? I mean, what you say is valuable and everything.
    However just imagine if you added some great pictures or video clips
    to give your posts more, “pop”! Your content is excellent but
    with pics and videos, this site could certainly be one of the very best in its field.
    Good blog!

    Look at my web site – joker123

  10. Today, I went to the beach with my children. 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 totally off topic but I had to tell someone!

  11. Very great post. I just stumbled upon your blog and wished to mention that I have truly enjoyed browsing your weblog
    posts. After all I will be subscribing on your feed and I’m hoping you write again very soon!

  12. 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 each time a comment is added I recieve four
    emails with the exact same comment. Perhaps there is
    an easy method you are able to remove me from
    that service? Cheers!

  13. Good day! This is my first visit to your blog! We are
    a collection of volunteers and starting a new project in a community in the same niche.
    Your blog provided us valuable information to work on. You have done a outstanding job!

  14. I feel this is one of the so much important info for me.
    And i am glad studying your article. However want to commentary on some general things, The site
    taste is wonderful, the articles is in point of fact nice : D.
    Excellent job, cheers

  15. I’m not sure exactly why but this weblog is loading very slow for
    me. Is anyone else having this issue or is it a problem
    on my end? I’ll check back later on and see if the problem still exists.

Comments are closed.