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,210 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. Hello! This post couldn’t be written any better! Reading this post reminds me of my good old room mate!
    He always kept talking about this. I will forward this write-up to him.

    Pretty sure he will have a good read. Many thanks for sharing!

  2. Unquestionably believe that which you said. Your favorite justification appeared to be on the internet the easiest thing to be aware of.
    I say to you, I certainly get annoyed while people consider worries
    that they plainly do not know about. You managed to hit the nail upon the top
    and also defined out the whole thing without having side effect , people could take
    a signal. Will likely be back to get more. Thanks

  3. Greetings from Los angeles! I’m bored to death at work so I decided to check
    out your website on my iphone during lunch break. I really like the info 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 phone .. I’m not even using WIFI, just
    3G .. Anyhow, great site!

  4. I’m not sure exactly why but this weblog is loading
    extremely 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.

  5. Admiring the dedication you put into your website and in depth information you offer.
    It’s good to come across a blog every once in a while that isn’t the same old rehashed material.
    Great read! I’ve saved your site and I’m adding your RSS feeds to my
    Google account.

  6. I’m now not sure the place you’re getting your info, however great topic.
    I must spend a while finding out much more or working out more.
    Thank you for wonderful information I used to be on the lookout for
    this information for my mission.

  7. fantastic points altogether, you just won a new
    reader. What may you recommend about your submit that
    you just made some days ago? Any positive?

  8. I know this if off topic but I’m looking into starting my own blog and was wondering what all
    is required to get set up? I’m assuming having a blog like yours would cost a pretty penny?
    I’m not very web smart so I’m not 100% certain. Any suggestions or advice
    would be greatly appreciated. Kudos

  9. Howdy! Do you know if they make any plugins to assist with Search Engine Optimization? I’m trying to get my blog
    to rank for some targeted keywords but I’m not seeing very good gains.
    If you know of any please share. Kudos!

  10. Why viewers still make use of to read news papers when in this technological world everything is existing on net?

  11. I like the valuable info you supply on your articles.
    I will bookmark your blog and take a look at again here regularly.
    I’m slightly certain I’ll be told plenty of new stuff right
    here! Best of luck for the following!

  12. You really make it seem so easy along with your presentation however
    I in finding this matter to be actually something which I
    feel I might never understand. It seems too complex and extremely extensive for
    me. I am having a look forward in your next post, I’ll try
    to get the hang of it!

  13. I am not positive the place you’re getting your info, but great topic.
    I must spend a while learning much more or figuring
    out more. Thanks for excellent info I used to be searching for this info for my mission.

  14. Do you have a spam issue on this site; I also am a blogger,
    and I was curious about your situation; many of us have created some nice
    practices and we are looking to swap methods with others,
    please shoot me an e-mail if interested.

  15. I’m truly enjoying the design and layout of your blog.
    It’s a very easy on the eyes which makes it much more pleasant for me to come
    here and visit more often. Did you hire out a designer
    to create your theme? Exceptional work!

  16. Good day! I could have sworn I’ve been to this web site before but after browsing through some of
    the posts I realized it’s new to me. Anyways, I’m certainly happy I discovered it and I’ll be bookmarking it and
    checking back often!

  17. I know this if off topic but I’m looking into starting my own blog and was wondering what all is needed to get setup?
    I’m assuming having a blog like yours would cost a pretty penny?

    I’m not very internet smart so I’m not 100% certain. Any tips
    or advice would be greatly appreciated. Cheers

  18. Excellent post. I was checking continuously this blog and I’m impressed!
    Very helpful info particularly the last part 🙂 I care
    for such info much. I was looking for this particular info for a very long time.
    Thank you and good luck.

  19. Link exchange is nothing else except it is just placing the other person’s weblog link
    on your page at proper place and other person will also do same in favor of you.

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

  21. Hey! I know this is kind of off topic but I was wondering which blog platform are you using for this website?
    I’m getting fed up of WordPress because I’ve had problems with hackers and I’m looking at alternatives
    for another platform. I would be awesome if you could point me in the direction of a good platform.

  22. you’re in point of fact a good webmaster. The website loading speed is
    amazing. It seems that you’re doing any unique trick.
    Also, The contents are masterpiece. you’ve done a excellent task on this topic!

  23. My brother suggested I may like this blog. He used to be entirely right.
    This put up actually made my day. You cann’t consider simply
    how a lot time I had spent for this information! Thanks!

  24. Hello, i think that i saw you visited my web site thus i got
    here to go back the want?.I’m attempting to find issues
    to improve my site!I guess its adequate to use a few
    of your ideas!!

  25. Hi would you mind stating which blog platform you’re working with?

    I’m looking to start my own blog in the near future but I’m having a difficult time selecting between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your design seems different then most blogs and I’m looking for something unique.
    P.S My apologies for being off-topic but I had to ask!

  26. Aw, this was an exceptionally good post. Finding the time and actual effort to make a really good article… but what
    can I say… I put things off a lot and don’t manage to get anything
    done.

Comments are closed.