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. 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 throw away your intelligence on just posting videos to your weblog when you could be giving
    us something enlightening to read?

  2. I’m not sure exactly why but this blog is loading very slow for me.

    Is anyone else having this issue or is it a issue on my end?
    I’ll check back later on and see if the problem still exists.

  3. Greetings from Los angeles! I’m bored to tears at work
    so I decided to check out your site on my iphone during lunch break.
    I love the info you provide here and can’t wait to take a look when I
    get home. I’m surprised at how quick your blog loaded
    on my phone .. I’m not even using WIFI, just 3G ..
    Anyways, great blog!

  4. It’s actually very complicated in this active life to listen news
    on TV, so I only use web for that purpose, and obtain the newest
    information.

  5. fascinating review. Such as visit now this site to
    comprehend slot deposit pulsa tanpa potongan. The below unbelievable webpage
    has received world-wide recognition from agen slot pulsa on line casino contenders in Indonesia.
    Now there are various expected promos should you join as of the moment.

  6. I feel this is one of the such a lot vital info for me.

    And i’m happy studying your article. But should statement on some
    common things, The site taste is ideal, the articles is actually
    great : D. Good activity, cheers

  7. I do not even understand how I ended up right here, however I
    thought this publish was once good. I don’t understand who you might be however certainly you are going to
    a well-known blogger if you happen to aren’t already. Cheers!

  8. Appreciating the hard work you put into your site and detailed information you provide.
    It’s good to come across a blog every once in a while that isn’t the same unwanted rehashed information. Wonderful read!
    I’ve bookmarked your site and I’m including your RSS
    feeds to my Google account.

  9. Greetings from Colorado! I’m bored to tears at work so I decided to check
    out your site on my iphone during lunch break. I enjoy the knowledge you present here and can’t wait to take a look when I get home.

    I’m shocked at how quick your blog loaded on my mobile ..

    I’m not even using WIFI, just 3G .. Anyways, superb site!

  10. I’m truly enjoying the design and layout of your site.
    It’s a very easy on the eyes which makes it much
    more enjoyable for me to come here and visit more often. Did you hire out a developer to create your theme?

    Outstanding work!

  11. What’s Going down i’m new to this, I stumbled upon this I have found It positively useful and it has helped me
    out loads. I’m hoping to give a contribution & help different
    customers like its helped me. Good job.

  12. wonderful points altogether, you just won a new reader. What would you recommend about your
    post that you simply made a few days in the past? Any positive?

  13. Тяговый аккумулятор на погрузчик купить
    https://belgorod.faamru.com
    аккумулятор не принимает заряда
    Тяговая аккумуляторная батарея 48V 750 Ah для погрузчика Yale NTA030SB M2502412513B40 Тяговые аккумуляторы 48V V 750 Ah 134 900 руб.

    армиториниколизм

  14. Heya! I just wanted to ask if you ever have any trouble 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 methods to stop hackers?

  15. What’s Happening i’m new to this, I stumbled upon this I have discovered It
    positively useful and it has helped me out loads.
    I’m hoping to give a contribution & help other customers like its helped me.
    Good job.

  16. We’re a group of volunteers and opening a new scheme in our community.
    Your site provided us with valuable information to work on. You’ve
    done a formidable job and our entire community will be grateful
    to you.

  17. Hi everyone, it’s my first go to see at this web page, and
    paragraph is in fact fruitful for me, keep up
    posting such articles or reviews.

  18. Howdy! I’m at work surfing around your blog from my new iphone 3gs!
    Just wanted to say I love reading your blog and look forward to all your posts!
    Carry on the great work!

  19. Greetings, I believe your blog might be having browser compatibility issues.
    Whenever I look at your blog in Safari, it looks fine but when opening in I.E., it’s
    got some overlapping issues. I just wanted to provide you
    with a quick heads up! Other than that, fantastic site!

  20. naturally like your web-site but you need to check
    the spelling on several of your posts. A number of them are rife
    with spelling issues and I find it very troublesome to tell the reality however I will surely come back again.

Comments are closed.