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. An impressive share! I’ve just forwarded this onto a friend who had been conducting a
    little homework on this. And he in fact bought me dinner due to
    the fact that I found it for him… lol. So allow me to reword this….

    Thanks for the meal!! But yeah, thanx for
    spending time to talk about this matter here on your web page.

  2. I have been browsing online more than 3 hours today, yet I never found any interesting article like yours.
    It is pretty worth enough for me. In my view, if all site owners and bloggers made
    good content as you did, the web will be a lot more useful than ever before.

  3. Pretty part of content. I just stumbled upon your site and
    in accession capital to claim that I get in fact enjoyed account your blog posts.

    Anyway I’ll be subscribing in your augment or even I success you get right
    of entry to consistently rapidly.

  4. Greetings from Colorado! I’m bored to death at work so I decided to
    check out your blog on my iphone during lunch break.
    I enjoy the information you provide here and can’t
    wait to take a look when I get home. I’m shocked at how fast your blog loaded on my cell phone ..
    I’m not even using WIFI, just 3G .. Anyways, awesome site!

  5. After I initially commented I seem to have clicked on the -Notify me
    when new comments are added- checkbox and now
    whenever a comment is added I recieve four emails with the exact same comment.
    There has to be a way you are able to remove me from that service?
    Many thanks!

  6. I’m not sure the place you are getting your info, but good topic.
    I must spend a while studying more or working out more.
    Thank you for wonderful information I used to be on the lookout for this information for my
    mission.

  7. This is the perfect web site for everyone who hopes to find out about this topic.

    You know so much its almost tough to argue with you (not
    that I personally would want to…HaHa). You definitely put a brand new
    spin on a topic that’s been discussed for a long time. Excellent stuff,
    just excellent!

  8. Heya just wanted to give you a quick heads up and let you know
    a few of the pictures 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.

  9. I am really impressed with your writing skills and also with the structure in your blog.
    Is that this a paid topic or did you modify it yourself?
    Either way stay up the excellent quality writing,
    it is rare to look a nice weblog like this one today..

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

  11. When I initially commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get three
    emails with the same comment. Is there any way you can remove me from that service?
    Cheers!

  12. It’s a shame you don’t have a donate button! I’d without a doubt donate to this outstanding blog!
    I guess for now i’ll settle for book-marking and adding your RSS feed
    to my Google account. I look forward to new updates and will share this blog with my Facebook group.
    Chat soon!

  13. 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 four emails
    with the same comment. Is there any way you can remove
    people from that service? Thank you!

  14. My family all the time say that I am killing
    my time here at net, however I know I am getting
    experience daily by reading thes good articles or reviews.

  15. Wonderful work! This is the type of information that are meant to be shared around the
    internet. Disgrace on the seek engines for no longer positioning this publish upper!

    Come on over and consult with my web site . Thank you
    =)

  16. I was curious if you ever considered changing the page layout of
    your blog? Its very well written; I love what youve got to
    say. But maybe you could a little more in the way of content so people could connect
    with it better. Youve got an awful lot of text for only having one or two pictures.
    Maybe you could space it out better?

  17. After I originally commented I seem to have clicked the
    -Notify me when new comments are added- checkbox and now each time a comment is added I
    recieve four emails with the same comment. Is there an easy method you can remove me
    from that service? Thanks a lot!

  18. Oh my goodness! Impressive article dude! Many thanks, However I am going through troubles with your RSS.
    I don’t understand why I am unable to join it. Is there anybody having the same RSS problems?
    Anybody who knows the solution will you kindly respond?

    Thanks!!

  19. naturally like your web-site but you have to take a look at the spelling on several of your posts.
    Several of them are rife with spelling issues and I in finding it very troublesome to inform the reality nevertheless I will certainly come
    again again.

  20. Hi, I think your blog might be having browser compatibility issues.
    When I look at your website in Chrome, 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, excellent blog!

  21. Heya i am for the first time here. I found this board and I in finding It really helpful & it helped me out much.

    I’m hoping to provide one thing back and help others such as you aided me.

  22. Hi there, simply became aware of your blog through Google, and located that it’s truly informative. I am going to watch out for brussels. I will be grateful in the event you proceed this in future. Many other people will be benefited out of your writing. Cheers!|

  23. of course like your website but you need to test the spelling on quite
    a few of your posts. A number of them are rife with spelling problems and I find it very troublesome to tell the reality however I will definitely come back
    again.

Comments are closed.