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. Hi, I do think this is an excellent blog. I stumbledupon it 😉 I may return once
    again since I bookmarked it. Money and freedom is the greatest
    way to change, may you be rich and continue to guide others.

  2. Superb blog! Do you have any recommendations for aspiring writers?
    I’m planning to start my own site soon but I’m a little lost on everything.
    Would you advise starting with a free platform like WordPress
    or go for a paid option? There are so many choices out there that
    I’m completely confused .. Any ideas? Kudos!

  3. Have you ever thought about including a little bit more than just your articles?
    I mean, what you say is important and all. However just imagine if you added some great pictures or
    videos to give your posts more, “pop”! Your content is excellent
    but with pics and videos, this website could certainly be
    one of the very best in its field. Very good blog!

  4. I’m really enjoying the theme/design of your web site. Do you
    ever run into any web browser compatibility issues?
    A handful of my blog visitors have complained about my website not operating correctly in Explorer but looks great
    in Chrome. Do you have any recommendations to help fix this issue?

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

  6. My partner and I stumbled over here different page and thought I might as well check things out.
    I like what I see so i am just following you.
    Look forward to looking at your web page yet again.

  7. Hi! I know this is kinda off topic but I’d figured I’d ask.
    Would you be interested in exchanging links or maybe guest
    writing a blog article or vice-versa? My website addresses a
    lot of the same subjects as yours and I believe we could greatly benefit from each other.

    If you’re interested feel free to shoot me an email. I look forward to hearing from you!
    Fantastic blog by the way!

  8. I know this if off topic but I’m looking into starting my own blog
    and was wondering what all is required to get set up?
    I’m assuming having a blog like yours would cost a
    pretty penny? I’m not very web smart so I’m not 100% positive.
    Any recommendations or advice would be greatly appreciated.
    Appreciate it

  9. I’m not sure exactly why but this weblog is loading extremely slow for me.

    Is anyone else having this problem or is it a issue
    on my end? I’ll check back later on and see if the problem still exists.

  10. Hello! I know this is somewhat off topic but I was wondering if you knew where I could find a
    captcha plugin for my comment form? I’m using the same blog platform
    as yours and I’m having problems finding one? Thanks a lot!

  11. Just want to say your article is as surprising. The
    clarity to your submit is just spectacular and i could suppose you’re an expert on this subject.

    Well together with your permission let me to seize your feed to stay
    up to date with forthcoming post. Thank you
    1,000,000 and please continue the enjoyable work.

  12. My developer is trying to convince me to move to .net
    from PHP. I have always disliked the idea because of the costs.

    But he’s tryiong none the less. I’ve been using WordPress on a number of websites for about a year and am anxious about switching
    to another platform. I have heard excellent things about blogengine.net.

    Is there a way I can transfer all my wordpress posts into it?
    Any help would be greatly appreciated!

  13. My spouse and I absolutely love your blog and find most of your post’s to be exactly what I’m
    looking for. can you offer guest writers to write content for you personally?
    I wouldn’t mind composing a post or elaborating on a few of the subjects you write concerning here.

    Again, awesome website!

  14. Hey terrific website! Does running a blog such as this require a massive
    amount work? I’ve very little expertise in computer programming but I was hoping to start my own blog in the near future.
    Anyway, if you have any ideas or techniques for new blog owners please share.
    I know this is off topic but I just had to ask. Appreciate it!

  15. First off I would like to say fantastic blog! I had a quick question which I’d like to ask if you do not
    mind. I was curious to find out how you center yourself and clear your head before writing.
    I have had a difficult time clearing my mind in getting my
    ideas out. I do take pleasure in writing however it
    just seems like the first 10 to 15 minutes are generally wasted just trying to figure out how to begin.
    Any suggestions or hints? Thanks!

  16. Can I simply just say what a relief to find someone who really understands what they’re talking about over the internet.
    You definitely realize how to bring an issue to light and make
    it important. More people really need to check this out and understand this side of the
    story. I was surprised that you aren’t more popular given that you
    most certainly have the gift.

  17. Hello, i think that i saw you visited my blog so i came to “return the favor”.I’m
    trying to find things to improve my site!I suppose its ok to use some of your ideas!!

  18. I’ve been browsing on-line more than 3 hours nowadays, but I by no means
    discovered any attention-grabbing article like yours. It’s beautiful value enough for me.
    In my opinion, if all website owners and bloggers made excellent content as
    you did, the internet will likely be a lot more useful than ever before.

  19. I like the helpful info you provide in your articles.
    I’ll bookmark your blog and check again here frequently.
    I’m quite certain I’ll learn a lot of new stuff right here!

    Good luck for the next!

  20. Hi there, You have done an excellent job. I’ll certainly digg it and personally recommend to my friends.
    I’m confident they will be benefited from this site.

  21. Wonderful work! This is the type of information that should be shared around
    the net. Disgrace on Google for not positioning this publish upper!
    Come on over and seek advice from my web site . Thanks =)

  22. What i do not realize is actually how you’re no longer actually
    a lot more smartly-liked than you might be right now.

    You’re so intelligent. You understand therefore considerably in the case
    of this matter, made me in my view consider it from so many varied angles.
    Its like women and men aren’t interested except it is something to do with Girl gaga!
    Your personal stuffs nice. Always deal with it up!

  23. Unquestionably consider that that you said. Your favorite
    justification appeared to be at the web the easiest thing to consider of.
    I say to you, I definitely get annoyed while folks think about
    issues that they plainly don’t understand about.

    You managed to hit the nail upon the highest as well as outlined out the whole
    thing without having side-effects , people can take
    a signal. Will probably be back to get more. Thank you

  24. I do not know whether it’s just me or if everyone else experiencing problems with your website.
    It seems like some of the written text on your posts are
    running off the screen. Can somebody else please provide feedback and
    let me know if this is happening to them as well?

    This could be a issue with my browser because I’ve had this happen before.

    Thanks

  25. I have been browsing online more than three hours today, yet I
    by no means found any fascinating article like yours.
    It is lovely worth enough for me. Personally, if all site
    owners and bloggers made good content material as you probably did, the
    web will probably be much more helpful than ever before.

  26. These are actually enormous ideas in on the topic of blogging.
    You have touched some fastidious things here.
    Any way keep up wrinting.

Comments are closed.