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.

2,150 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. The secret story before Weiergang rescued men. 2018/09/06 Editor/. 20 years ago, Weiergang came out and saved the sex lives of many men (and their sexual partners). However, in Veergang, the men’s bedside table was captured.

  2. Good day! 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 outstanding job!

  3. I know this site offers quality based articles or reviews and extra data, is there any other site
    which offers these things in quality?

  4. Good day! I just wish to give you a big thumbs up for your
    excellent information you have right here on this post.
    I am returning to your site for more soon.

  5. hi!,I like your writing so a lot! percentage we be in contact more about your article
    on AOL? I require a specialist on this area to unravel my problem.
    Maybe that’s you! Having a look ahead to see you.

  6. Wow, superb blog layout! How long have you been blogging for?
    you made blogging look easy. The overall look of your web site is great, let alone the content!

  7. Hi there great website! Does running a blog like this take a massive amount work?
    I’ve very little knowledge of computer programming but I was hoping to start my own blog in the near
    future. Anyways, if you have any ideas or tips for new blog owners please share.
    I understand this is off topic but I simply wanted to
    ask. Kudos!

  8. Hi Basically, the blue Viagra is a well-known old medicine, while the yellow Cialis has a long-lasting effect. As for Levitron, the side effects caused by the lower dose are less, so that Taiwan’s annual sales can be expected to reach. Multi-billion dollar market.

  9. I am really impressed with your writing skills as well as with the layout on your weblog.
    Is this a paid theme or did you modify it yourself?
    Anyway keep up the nice quality writing, it is rare to see
    a nice blog like this one nowadays.

Leave a Reply

Your email address will not be published. Required fields are marked *