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. What’s Happening i’m new to this, I stumbled upon this I’ve discovered It positively helpful and it
    has helped me out loads. I hope to give a contribution & help
    different customers like its helped me. Great job.

  2. Great blog you have got here.. It’s difficult to find
    high quality writing like yours nowadays. I honestly appreciate
    people like you! Take care!!

  3. Have you ever thought about publishing an e-book or guest authoring
    on other sites? I have a blog based on the same
    topics you discuss and would love to have you share some stories/information. I know my readers would appreciate your work.
    If you’re even remotely interested, feel free to send me an email.

  4. Fantastic blog! Do you have any tips and hints for aspiring writers?
    I’m hoping to start my own site soon but I’m a little lost on everything.
    Would you propose starting with a free platform like WordPress or go for a paid option? There are so many choices out there that I’m totally confused ..

    Any recommendations? Appreciate it!

  5. With havin so much written content do you ever
    run into any issues of plagorism or copyright infringement?
    My blog has a lot of unique content I’ve either created myself or outsourced but it appears a lot of it is popping it
    up all over the internet without my permission. Do you know any methods
    to help protect against content from being
    stolen? I’d certainly appreciate it.

  6. Hey there! I’ve been reading your site for some time now and finally got the courage to go ahead and give
    you a shout out from Lubbock Texas! Just wanted to mention keep up
    the fantastic work!

  7. I’m not sure why but this web site 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 and see if the problem still exists.

  8. An intriguing discussion is definitely worth comment.
    I do think that you should publish more about this issue, it
    might not be a taboo matter but generally people do not discuss such topics.

    To the next! Cheers!!

  9. I like the helpful information you provide in your articles.
    I will bookmark your blog and check again here frequently.
    I’m quite sure I will learn a lot of new stuff right here!
    Best of luck for the next!

  10. I am curious to find out what blog platform you
    happen to be using? I’m having some minor security
    problems with my latest blog and I would like to find something more safeguarded.
    Do you have any solutions?

  11. My spouse and I stumbled over here by a different page and thought I might as well check things
    out. I like what I see so now i am following
    you. Look forward to finding out about your web page yet
    again.

  12. I am extremely impressed along with your writing
    skills and also with the structure for your blog.

    Is that this a paid subject or did you modify it your self?
    Either way keep up the excellent quality writing,
    it is rare to see a nice weblog like this one today..

  13. A motivating discussion is definitely worth comment.
    I believe that you ought to publish more on this subject matter,
    it might not be a taboo subject but usually people don’t discuss such subjects.
    To the next! Kind regards!!

  14. After I originally left a comment I appear to have clicked the
    -Notify me when new comments are added- checkbox and
    from now on every time a comment is added I
    get four emails with the same comment. There has to be
    a way you can remove me from that service? Appreciate it!

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

  16. Wow, incredible blog structure! How lengthy have you been blogging for?
    you make running a blog glance easy. The total glance of your site is magnificent, as neatly as the content material!

  17. The other day, while I was at work, my sister stole my apple ipad and tested to see if
    it can survive a twenty five foot drop, just so she can be a youtube sensation. My iPad is now broken and she has 83 views.

    I know this is totally off topic but I had to share it with
    someone!

  18. When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time
    a comment is added I get three e-mails with the same comment.
    Is there any way you can remove me from that
    service? Bless you!

  19. Incredible! This blog looks exactly like my old one!
    It’s on a entirely different topic but it
    has pretty much the same page layout and design. Wonderful choice of colors!

Comments are closed.