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.

48,220 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. My family every time say that I am wasting my time here at net,
    but I know I am getting knowledge all the time by reading such nice
    articles.

  2. I believe that is one of the so much vital info for me. And i’m glad reading your
    article. However wanna statement on few normal things,
    The web site taste is great, the articles is in reality nice :
    D. Just right job, cheers

  3. I don’t even know how I stopped up here, but I believed this put up was once great.
    I don’t understand who you might be but certainly you’re going to a
    well-known blogger if you happen to are not already.

    Cheers!

  4. My developer is trying to persuade me to move to .net from PHP.
    I have always disliked the idea because of the
    costs. But he’s tryiong none the less. I’ve been using Movable-type on a number of
    websites for about a year and am worried about switching to another platform.

    I have heard very good things about blogengine.net.
    Is there a way I can import all my wordpress posts into it?
    Any help would be really appreciated!

  5. Great weblog here! Also your site so much up very fast!
    What host are you the usage of? Can I get your associate
    hyperlink on your host? I desire my site loaded up as quickly as
    yours lol

  6. With havin so much content do you ever run into any issues of
    plagorism or copyright infringement? My blog has a lot of unique content I’ve either authored myself or outsourced but it appears 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 ripped off?
    I’d certainly appreciate it.

  7. Helpful info. Lucky me I found your website by accident, and I am shocked why this accident did not came about earlier!
    I bookmarked it.

  8. Thank you, I’ve just been searching for info about this topic for
    a while and yours is the best I’ve discovered till
    now. However, what concerning the bottom
    line? Are you sure in regards to the supply?

  9. Way cool! Some very valid points! I appreciate you writing this post and also the
    rest of the site is also very good.

  10. Good day! I could have sworn I’ve been to this website before but after
    checking through some of the post I realized it’s new
    to me. Anyways, I’m definitely glad I found it
    and I’ll be bookmarking and checking back frequently!

Comments are closed.