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. Hmm it appears like your site ate my first comment (it was extremely long) so I guess I’ll just sum it
    up what I wrote and say, I’m thoroughly enjoying your blog.
    I as well am an aspiring blog writer but I’m still new to everything.
    Do you have any suggestions for first-time blog writers?
    I’d definitely appreciate it.

  2. Howdy! I could have sworn I’ve been to this website before but after
    reading through some of the post I realized it’s new to me.
    Nonetheless, I’m definitely delighted I found it and I’ll
    be book-marking and checking back frequently!

  3. Hi, I think your site might be having browser compatibility issues.
    When I look at your blog in Firefox, it looks fine but when opening in Internet Explorer,
    it has some overlapping. I just wanted to give you
    a quick heads up! Other then that, fantastic blog!

  4. Hey there would you mind letting me know which webhost you’re using?
    I’ve loaded your blog in 3 completely different web
    browsers and I must say this blog loads a lot quicker then most.

    Can you suggest a good web hosting provider at a reasonable price?
    Cheers, I appreciate it!

  5. This design is steller! You most certainly know how to keep a reader entertained.
    Between your wit and your videos, I was almost moved to start
    my own blog (well, almost…HaHa!) Wonderful job.
    I really enjoyed what you had to say, and more than that, how you presented it.
    Too cool!

  6. Exceptional post however I was wanting to know if you could write a litte more on this topic?
    I’d be very thankful if you could elaborate a little bit more.
    Thank you!

  7. Hi, I do believe this is a great blog. I stumbledupon it 😉 I
    may revisit yet again since i have book-marked it.
    Money and freedom is the greatest way to change, may you be rich and
    continue to guide others.

  8. I am really loving the theme/design of your blog. Do you
    ever run into any internet browser compatibility issues? A number of my blog visitors have complained
    about my blog not working correctly in Explorer but looks great in Firefox.

    Do you have any solutions to help fix this problem?

  9. Please let me know if you’re looking for a author for your site.
    You have some really good posts and I think I would be a good asset.

    If you ever want to take some of the load off, I’d love to write some content for your blog in exchange for a link back to mine.
    Please blast me an e-mail if interested. Thanks!

  10. Oh my goodness! Incredible article dude! Thank you so
    much, However I am having troubles with your RSS.
    I don’t know why I am unable to subscribe to it.
    Is there anybody getting similar RSS issues? Anyone that knows the answer can you kindly respond?
    Thanx!!

  11. After I originally commented I appear to have clicked the
    -Notify me when new comments are added- checkbox and
    from now on each time a comment is added I receive four emails with the same comment.
    There has to be a means you are able to remove me from that service?
    Thank you!

  12. I believe what you said made a lot of sense. However, what about
    this? suppose you wrote a catchier post title?
    I mean, I don’t want to tell you how to run your website,
    however suppose you added something that grabbed a person’s
    attention? I mean Contoh Soal Pemrograman – Pola Segitiga Siku-siku – Umar faisol is kinda vanilla.
    You might peek at Yahoo’s front page and see how they
    write post headlines to get viewers to open the links.

    You might try adding a video or a pic or two to get people interested about what you’ve
    got to say. Just my opinion, it could make your website a little livelier.

  13. Excellent goods from you, man. I’ve understand your stuff previous to and you
    are just extremely great. I actually like what
    you’ve acquired here, really like what you’re stating and the way in which you say it.
    You make it enjoyable and you still take care of to keep it sensible.
    I can’t wait to read far more from you. This
    is really a great web site.

  14. Hello there! This is kind of off topic but I need some advice from an established blog.
    Is it very difficult to set up your own blog? I’m not very
    techincal but I can figure things out pretty quick.
    I’m thinking about making my own but I’m not sure where
    to begin. Do you have any ideas or suggestions? Thanks

  15. Today, I went to the beach front with my kids.
    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!

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

Comments are closed.