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 seem to understand
    so much approximately this, such as you wrote the book in it or something.
    I feel that you simply can do with some % to force the message home a little bit, but other than that, that is excellent blog.
    A fantastic read. I will certainly be back.

  2. Hello, i think that i noticed you visited my weblog so i got here to go back the prefer?.I am attempting
    to find things to improve my web site!I guess its adequate to use a
    few of your ideas!!

  3. Hello! 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 useful information to work on. You have done a
    marvellous job!

  4. Do you mind if I quote a couple of your posts as long
    as I provide credit and sources back to your blog?
    My blog site is in the exact same area of interest as yours and my visitors would
    truly benefit from a lot of the information you present here.
    Please let me know if this alright with you.
    Regards!

  5. 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 completely off topic but I had to tell someone!

  6. Have you ever thought about creating an ebook or guest
    authoring on other blogs? I have a blog centered on the same topics you
    discuss and would love to have you share some stories/information. I know my subscribers would value your work.
    If you are even remotely interested, feel free to send
    me an email.

  7. 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 placed 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!

  8. I like the valuable information you provide in your articles.
    I’ll bookmark your blog and check again here frequently. I’m quite certain I will learn many new stuff right here!
    Best of luck for the next!

  9. Hmm it seems like your site ate my first comment (it was extremely 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 writer but I’m still new to everything.
    Do you have any helpful hints for novice blog writers?
    I’d definitely appreciate it.

  10. We’re a group of volunteers and opening a brand new scheme in our community.
    Your web site offered us with valuable information to work on. You have done an impressive
    task and our whole neighborhood can be grateful to you.

  11. I like the helpful info you supply for your articles.
    I will bookmark your weblog and take a look at again here frequently.
    I am reasonably sure I will learn many new stuff proper right here!
    Best of luck for the following!

  12. Hello! I could have sworn I’ve been to this site 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 often!

  13. An intriguing discussion is worth comment. There’s no doubt that that you should publish more about this issue, it might not be a taboo matter but typically people do not discuss such issues.
    To the next! Best wishes!!

  14. I take pleasure in, result in I discovered exactly what I was taking a look for.
    You’ve ended my 4 day lengthy hunt! God Bless you man. Have a nice day.
    Bye

  15. We are a group of volunteers and opening a new scheme in our community.

    Your site offered us with valuable info to work on. You have done a formidable job and our whole community will be grateful to you.

  16. appealing review. Also visit this site that may be enjoyed
    slot pulsa tanpa potongan. This site has received background
    with slot pulsa gambling establishment patients in Indonesia.
    Right now there will be a great deal of exciting promos in case you join today.

  17. Does your blog have a contact page? I’m having a tough time locating it but, I’d
    like to shoot you an e-mail. I’ve got some suggestions for your blog you might be
    interested in hearing. Either way, great site and I look forward to seeing it improve over time.

  18. Fine way of explaining, and nice piece of writing to get data regarding my presentation topic, which i am going
    to present in university.

  19. constantly i used to read smaller articles or reviews that also clear their
    motive, and that is also happening with this piece of writing
    which I am reading at this time.

Comments are closed.