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. Useful information. Fortunate me I found your web site by accident, and I
    am surprised why this accident did not happened in advance!
    I bookmarked it.

  2. Wow, incredible weblog structure! How lengthy have you been blogging
    for? you made blogging look easy. The whole glance of your site is great, let alone
    the content!

  3. obviously like your web site but you have to test the spelling on quite a few
    of your posts. A number of them are rife with spelling problems
    and I find it very bothersome to tell the truth then again I’ll definitely come again again.

  4. Good day! Do you know if they make any plugins to safeguard against hackers?
    I’m kinda paranoid about losing everything I’ve worked hard on. Any tips?

  5. I’m gone to say to my little brother, that he should also go to see this weblog on regular basis to take updated from newest information.

  6. 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
    months of hard work due to no backup. Do you have any solutions to stop hackers?

  7. I loved as much as you’ll receive carried out right here.
    The sketch is tasteful, your authored material stylish.

    nonetheless, you command get bought an impatience over that you wish
    be delivering the following. unwell unquestionably come
    further formerly again since exactly the same nearly a lot often inside case you shield this hike.

  8. We are a group of volunteers and starting a new scheme in our community.
    Your web site offered us with valuable information to work on. You’ve done a formidable job and our entire community will
    be grateful to you.

  9. excellent issues altogether, you simply received a logo new reader.
    What might you suggest in regards to your submit that you simply made
    a few days ago? Any certain?

  10. Heya! I’m at work surfing around your blog from
    my new apple iphone! Just wanted to say I love reading through
    your blog and look forward to all your posts!
    Carry on the outstanding work!

  11. Hi, There’s no doubt that your web site could possibly be having browser compatibility problems.
    When I take a look at your web site in Safari, it looks fine however when opening in IE,
    it has some overlapping issues. I merely wanted to provide you with a quick
    heads up! Besides that, excellent blog!

  12. Hello, I do think your blog may be having web browser compatibility problems.
    When I look at your blog in Safari, it looks fine but when opening in IE, it has some overlapping issues.
    I merely wanted to provide you with a quick heads up!
    Apart from that, fantastic site!

  13. Write more, thats all I have to say. Literally, it seems
    as though you relied on the video to make your point. You definitely know
    what youre talking about, why waste your intelligence on just posting videos to
    your weblog when you could be giving us something informative to read?

  14. Hi just wanted to give you a quick heads up and let you
    know a few of the images aren’t loading correctly. I’m not sure why but I
    think its a linking issue. I’ve tried it in two different browsers and both
    show the same outcome.

  15. I know this web page provides quality dependent articles or reviews and extra information, is there any other web site
    which provides these data in quality?

  16. Aw, this was a very good post. Taking the time and actual effort
    to generate a good article… but what can I say… I
    put things off a whole lot and don’t manage to get anything done.

Comments are closed.