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. I do consider all of the concepts you’ve introduced in your post.
    They are very convincing and will definitely work. Nonetheless,
    the posts are too short for beginners. Could you please lengthen them a little from subsequent time?
    Thanks for the post.

  2. Have you ever thought about adding a little
    bit more than just your articles? I mean, what you say is fundamental and all.
    However imagine if you added some great pictures or videos to
    give your posts more, “pop”! Your content is
    excellent but with images and video clips, this blog could undeniably be
    one of the best in its niche. Superb blog!

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

  4. Wonderful site you have here but I was curious if you knew of any user discussion forums that cover the same topics talked about here?
    I’d really like to be a part of online community where
    I can get comments from other experienced people that share the same interest.

    If you have any recommendations, please let me know.
    Thank you!

  5. 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 people from that service?
    Thanks a lot!

  6. Have you ever thought about publishing an ebook or
    guest authoring on other websites? I have a blog based on the same topics you discuss and would love to have you share some stories/information. I know my viewers would appreciate your work.
    If you are even remotely interested, feel free to shoot me an e mail.

  7. I love your blog.. very nice colors & theme. Did you make this website yourself or did you hire someone to do it for you?
    Plz respond as I’m looking to create my own blog and would like to know where u got this from.
    thanks a lot

  8. Nice post. I learn something new and challenging on websites I stumbleupon every day.
    It’s always interesting to read articles from other writers and practice something
    from other websites.

  9. Undeniably imagine that that you stated. Your favourite justification seemed to be on the net the simplest factor to take note of.
    I say to you, I definitely get irked even as people consider
    worries that they just don’t recognise about. You
    controlled to hit the nail upon the top as neatly as defined
    out the entire thing without having side-effects , other folks could take a signal.
    Will likely be back to get more. Thank you

  10. Thanks for one’s marvelous posting! I truly enjoyed reading it, you might be a great author.
    I will remember to bookmark your blog and definitely will come back in the
    future. I want to encourage yourself to continue your great job, have
    a nice weekend!

  11. Spot on with this write-up, I seriously believe that this site needs a great deal
    more attention. I’ll probably be back again to read through more, thanks
    for the advice!

  12. You made some decent points there. I looked on the internet for additional information about the issue and
    found most individuals will go along with your views on this site.

  13. Greetings from Carolina! I’m bored to death at work so I decided to browse your blog
    on my iphone during lunch break. I really like
    the information you provide here and can’t wait to take a
    look when I get home. I’m surprised at how quick your blog loaded on my mobile ..
    I’m not even using WIFI, just 3G .. Anyhow, wonderful blog!

  14. I’m curious to find out what blog platform you have been using?
    I’m having some small security issues with my latest blog and I would like to find something more safe.

    Do you have any recommendations?

  15. Hi, Neat post. There’s a problem along with your site in web explorer, would test this?
    IE still is the marketplace leader and a large portion of people will pass over your excellent
    writing because of this problem.

  16. I used to be suggested this blog through my cousin. I am now not certain whether or not this put
    up is written by him as nobody else recognise such designated about my trouble.

    You’re amazing! Thank you!

  17. I’m excited to uncover this great site. I wanted to thank you for ones time just for this fantastic
    read!! I definitely appreciated every part of it and i also have
    you saved to fav to check out new things in your site.

  18. great put up, very informative. I’m wondering
    why the other specialists of this sector do
    not realize this. You must continue your writing. I am sure, you have a great readers’ base already!

  19. Pretty great post. I simply stumbled upon your blog and
    wished to say that I have truly loved surfing around your weblog posts.

    After all I will be subscribing for your rss feed and I’m hoping
    you write again very soon!

  20. Hey! This post couldn’t be written any better! Reading through this post reminds me of my good old room mate!
    He always kept chatting about this. I will forward this post to him.
    Fairly certain he will have a good read. Thank you for sharing!

  21. Write more, thats all I have to say. Literally, it seems as though you relied
    on the video to make your point. You definitely know what youre talking about, why throw away your intelligence on just posting videos to your site when you could be giving
    us something informative to read?

  22. I am extremely inspired along with your writing abilities and also
    with the format for your blog. Is that this a paid theme or did you modify it your self?
    Anyway stay up the nice high quality writing, it is rare to
    look a great blog like this one today..

  23. An outstanding share! I have just forwarded this onto a colleague who has been doing a little homework on this.
    And he actually ordered me dinner due to the fact that I discovered it for him…
    lol. So let me reword this…. Thanks for
    the meal!! But yeah, thanx for spending the time to
    discuss this subject here on your site.

  24. This is the perfect site for anyone who would like to find out about this topic.
    You know a whole lot its almost tough to argue with you (not that I
    actually will need to…HaHa). You certainly put a brand new spin on a subject that’s been discussed for a long time.
    Excellent stuff, just great!

  25. Pretty nice post. I just stumbled upon your blog and wished
    to say that I have really enjoyed surfing around your
    blog posts. After all I will be subscribing to your rss feed and I hope you write again soon!

  26. Hey there, You’ve done an excellent job. I will certainly digg it and personally recommend to my friends.
    I am sure they’ll be benefited from this site.

  27. Thank you for some other fantastic post.
    Where else could anybody get that kind of info
    in such a perfect means of writing? I’ve a
    presentation next week, and I’m at the search for
    such information.

  28. Hey! I understand this is somewhat off-topic but I
    needed to ask. Does running a well-established blog
    such as yours require a massive amount work?
    I am brand new to writing a blog however I do write in my diary everyday.
    I’d like to start a blog so I will be able to share my experience and thoughts online.
    Please let me know if you have any kind of recommendations or tips for brand
    new aspiring blog owners. Appreciate it!

  29. Hello, i think that i saw you visited my web site thus i came
    to “return the favor”.I am attempting to find things to enhance my web site!I suppose its ok to use
    some of your ideas!!

  30. Hey I know this is off topic but I was wondering if you knew of any widgets I could
    add to my blog that automatically tweet my newest twitter updates.
    I’ve been looking for a plug-in like this for quite some time and was hoping
    maybe you would have some experience with something like this.
    Please let me know if you run into anything. I truly enjoy reading your blog and I look forward
    to your new updates.

  31. First of all I want to say great blog! I had a quick question that I’d like to ask if you don’t mind.
    I was interested to know how you center yourself and clear your head before writing.
    I have had a difficult time clearing my thoughts in getting my
    thoughts out there. I do enjoy writing but it just
    seems like the first 10 to 15 minutes are generally lost simply
    just trying to figure out how to begin. Any recommendations or hints?
    Thanks!

Comments are closed.