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. Way cool! Some very valid points! I appreciate you writing this article and the rest of the site is extremely good.

  2. Attractive element of content. I just stumbled upon your web site and in accession capital to claim that I acquire actually loved account your weblog posts.
    Any way I’ll be subscribing for your augment or
    even I success you access consistently fast.

  3. Hey! Do you know if they make any plugins
    to help with SEO? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good success.
    If you know of any please share. Kudos!

  4. When I originally commented I appear to have
    clicked the -Notify me when new comments are added- checkbox
    and now each time a comment is added I receive 4 emails with the exact same
    comment. Perhaps there is a means you are able to remove me
    from that service? Kudos!

  5. Hey there just wanted to give you a quick heads up. The words in your article seem to be running off the screen in Firefox.
    I’m not sure if this is a format issue or something to do
    with web browser compatibility but I figured I’d post to let you know.
    The design and style look great though! Hope you get the issue fixed soon. Cheers

  6. Hello are using WordPress for your site platform?
    I’m new to the blog world but I’m trying to get started and create my
    own. Do you require any html coding expertise
    to make your own blog? Any help would be greatly appreciated!

  7. Hi there! I just wanted to ask if you ever have any problems with hackers?
    My last blog (wordpress) was hacked and I ended up losing several weeks of hard work due to
    no back up. Do you have any solutions to stop hackers?

  8. Pretty component to content. I just stumbled upon your weblog and in accession capital to assert that I get actually loved account your weblog
    posts. Anyway I’ll be subscribing in your augment and even I fulfillment you access persistently rapidly.

  9. 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
    blog when you could be giving us something informative to read?

  10. It is the best time to make some plans for the longer term and
    it’s time to be happy. I’ve read this publish and if I could I wish to recommend you few fascinating issues or tips.
    Maybe you can write subsequent articles referring to this article.
    I desire to learn more issues approximately it!

  11. Have you ever considered creating an ebook or guest
    authoring on other blogs? I have a blog based on the same topics you discuss
    and would love to have you share some stories/information. I
    know my subscribers would appreciate your work. If you’re even remotely interested, feel free to send me an email.

  12. Hello, I do think your web site may be having browser compatibility problems.
    When I look at your site in Safari, it looks fine however, when opening in IE, it’s got some overlapping issues.
    I simply wanted to provide you with a quick heads
    up! Other than that, wonderful blog!

  13. I like the valuable info you provide in your articles. I’ll
    bookmark your blog and take a look at once more here regularly.
    I’m rather sure I’ll be told many new stuff proper right here!
    Best of luck for the following!

  14. Having read this I believed it was rather enlightening.

    I appreciate you spending some time and effort to put this information together.
    I once again find myself personally spending way too much time both reading and leaving comments.
    But so what, it was still worth it!

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

  16. Wow that was unusual. I just wrote an very long comment but after I clicked submit my comment didn’t show up.
    Grrrr… well I’m not writing all that over again. Anyhow, just wanted to say wonderful blog!

  17. exhilarating review. At the same time visit my site to be aware of situs slot online.

    Fantastic site has received recognition coming from judi
    slot online gambling men and women in Indonesia. At this time there are actually plenty
    of lovely promos if people join currently.

  18. Hmm is anyone else encountering problems with the pictures on this blog loading?

    I’m trying to determine if its a problem on my end or if it’s the blog.
    Any responses would be greatly appreciated.

  19. Hi there! This is my first visit to your blog!

    We are a collection of volunteers and starting a new
    initiative in a community in the same niche. Your
    blog provided us useful information to work on. You have done a wonderful job!

  20. I have been surfing online more than 4 hours today, yet I never found any interesting
    article like yours. It is pretty worth enough for me. Personally, if all web owners and bloggers made good content as you did, the
    internet will be much more useful than ever before.

  21. constantly i used to read smaller articles which as well
    clear their motive, and that is also happening with this post which I am reading at this
    time.

  22. Someone necessarily help to make significantly posts
    I would state. This is the first time I frequented your web page and thus far?
    I surprised with the analysis you made to create this actual post amazing.
    Magnificent activity!

  23. Today, I went to the beach front 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
    entirely off topic but I had to tell someone!

  24. Greetings from California! I’m bored to death at work so I decided
    to browse your blog on my iphone during lunch break.
    I love the knowledge you present here and can’t wait to take a look when I get home.
    I’m shocked at how fast your blog loaded on my mobile .. I’m not even using
    WIFI, just 3G .. Anyways, fantastic blog!

Comments are closed.