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

  1. 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 totally off topic but I had to tell someone!

  2. hi!,I love your writing so so much! share we keep up a correspondence more approximately your article
    on AOL? I need a specialist on this space to resolve my problem.

    Maybe that is you! Looking forward to look you.

  3. Exceptional post however I was wondering if you could write a
    litte more on this topic? I’d be very grateful if you could elaborate a little bit more.
    Thanks!

  4. The other day, while I was at work, my cousin stole my iphone and tested to see if it can survive a forty foot
    drop, just so she can be a youtube sensation. My apple ipad is now broken and she
    has 83 views. I know this is entirely off topic but
    I had to share it with someone!

  5. I will immediately seize your rss as I can not to find your e-mail subscription hyperlink or newsletter service.
    Do you’ve any? Please allow me understand so that I could subscribe.
    Thanks.

  6. I’m amazed, I have to admit. Rarely do I come across a blog that’s both educative and amusing, and let me tell you, you have hit
    the nail on the head. The problem is an issue that too few folks are
    speaking intelligently about. I’m very happy that I came
    across this in my search for something relating to
    this.

  7. Hola! I’ve been reading your weblog for a long time now and finally got the courage to
    go ahead and give you a shout out from Houston Tx! Just wanted to tell you keep up the good job!

  8. Incredible! This blog looks just like my old one! It’s on a totally different topic but it has pretty much the
    same layout and design. Great choice of colors!

  9. Hello would you mind letting me know which hosting company you’re utilizing?
    I’ve loaded your blog in 3 different browsers and I must say this blog loads a lot quicker then most.
    Can you recommend a good web hosting provider at a honest
    price? Many thanks, I appreciate it!

  10. Hey would you mind stating which blog platform you’re
    using? I’m planning to start my own blog soon but I’m having a hard time choosing between BlogEngine/Wordpress/B2evolution and
    Drupal. The reason I ask is because your layout seems different
    then most blogs and I’m looking for something completely unique.

    P.S Apologies for being off-topic but I had to ask!

  11. Whats up this is kinda of off topic but I was wanting to know if blogs use
    WYSIWYG editors or if you have to manually code with
    HTML. I’m starting a blog soon but have no coding skills so I wanted to get advice from someone with experience.
    Any help would be enormously appreciated!

  12. Fascinating blog! Is your theme custom made or did you download it from somewhere?
    A theme like yours with a few simple adjustements would really
    make my blog stand out. Please let me know where you got your design. Bless you

  13. Have you ever thought about publishing an ebook or guest authoring on other sites?
    I have a blog centered on the same topics you discuss and
    would really like to have you share some stories/information.
    I know my viewers would value your work. If you’re even remotely interested, feel free to
    send me an e-mail.

  14. Excellent beat ! I would like to apprentice whilst you amend your web site, how could i subscribe for a
    blog website? The account aided me a applicable
    deal. I have been tiny bit familiar of this your broadcast
    provided brilliant transparent concept

  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 developer to create your theme?

    Superb work!

  16. I got this site from my buddy who informed me on the topic of this web site and at the moment
    this time I am visiting this website and reading very informative articles at this place.

  17. of course like your web-site but you need to check the spelling on quite a few of
    your posts. Several of them are rife with spelling problems and I find it very bothersome to tell the reality nevertheless I
    will surely come back again.

  18. I don’t even know how I ended up here, but I thought this post was good.
    I do not know who you are but certainly you are going to a famous blogger if you aren’t already ;
    ) Cheers!

  19. I know this if off topic but I’m looking into starting my own weblog and was curious what all is
    required 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 recommendations or advice would be greatly appreciated.
    Appreciate it

  20. Very nice post. I just stumbled upon your blog and wanted to say that I have truly enjoyed browsing your blog posts.
    In any case I will be subscribing to your rss feed and I
    hope you write again very soon!

  21. We absolutely love your blog and find the majority of
    your post’s to be exactly what I’m looking for. Does one offer guest writers to write content for you?
    I wouldn’t mind producing a post or elaborating on a number
    of the subjects you write with regards to here. Again, awesome
    blog!

  22. This is the right web site for anybody who really wants to find out
    about this topic. You realize so much its almost tough to argue with you (not that I personally will need to…HaHa).
    You certainly put a new spin on a subject that has been discussed
    for years. Wonderful stuff, just excellent!

  23. Good post. I learn something new and challenging on sites I stumbleupon on a daily basis.
    It’s always useful to read through articles from other authors and
    practice a little something from other web sites.

  24. Excellent pieces. Keep posting such kind of information on your page.

    Im really impressed by your site.
    Hey there, You have done an incredible job.
    I’ll certainly digg it and in my view suggest
    to my friends. I’m confident they will be benefited from this web
    site.

  25. I really like your blog.. very nice colors &
    theme. Did you create this website yourself or did you hire
    someone to do it for you? Plz reply as I’m looking
    to create my own blog and would like to know where u got
    this from. kudos

  26. Great blog here! Also your website loads up very fast!
    What host are you using? Can I get your affiliate link to your host?
    I wish my website loaded up as fast as yours lol

Comments are closed.