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. Have you ever considered publishing an ebook or guest authoring
    on other websites? I have a blog centered on the
    same topics you discuss and would love to have you share some
    stories/information. I know my viewers would value your work.

    If you are even remotely interested, feel free to shoot me an e-mail.

  2. Whats up are using WordPress for your blog platform? I’m new to the blog world
    but I’m trying to get started and create my own. Do you
    need any html coding expertise to make your own blog?
    Any help would be really appreciated!

  3. It is perfect time to make some plans for the future and it is time
    to be happy. I’ve learn this post and if I may just I wish to suggest you some interesting things
    or suggestions. Perhaps you can write subsequent articles relating to this
    article. I desire to learn more things approximately it!

  4. 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 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 totally off topic but I had
    to tell someone!

  5. Generally I don’t read post on blogs, however I would like to say that
    this write-up very pressured me to check out and do it!
    Your writing taste has been surprised me. Thank you, quite
    great post.

  6. I’m extremely impressed with your writing skills and also with the layout
    on your weblog. Is this a paid theme or did you modify it yourself?

    Anyway keep up the excellent quality writing, it’s rare to see a great blog
    like this one these days.

  7. I do not know if it’s just me or if everyone else encountering
    issues with your website. It seems like some of the 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 might be a problem with my internet browser because
    I’ve had this happen before. Cheers

  8. Way cool! Some extremely valid points! I appreciate you penning this write-up and
    also the rest of the site is extremely good.

  9. Hi there I am so happy I found your site, I really found you by accident, while I was browsing
    on Aol for something else, Anyhow I am here now and would just like to say cheers for a incredible post and a all round interesting blog (I also love the
    theme/design), I don’t have time to go through
    it all at the moment but I have saved it and also added your RSS feeds, so when I have time I will be back to read a
    great deal more, Please do keep up the great b.

  10. You’re so awesome! I don’t believe I’ve read anything like that before.
    So good to discover someone with a few original thoughts
    on this issue. Seriously.. many thanks for starting this up.
    This site is one thing that is required on the internet,
    someone with a little originality!

  11. Have you ever considered about including a little bit more
    than just your articles? I mean, what you say is valuable and all.
    Nevertheless imagine if you added some great images or videos to give your posts more, “pop”!
    Your content is excellent but with images and video clips, this site
    could definitely be one of the very best in its niche. Superb blog!

  12. I’ve read several excellent stuff here. Certainly value bookmarking for revisiting.
    I wonder how much effort you put to make this kind of magnificent informative site.

  13. Spot on with this write-up, I seriously believe that this web site needs a lot more attention. I’ll probably
    be returning to read through more, thanks for the information!

  14. What i don’t understood is in truth how you’re not really much more neatly-appreciated than you might be now.

    You’re very intelligent. You understand thus considerably in the case of this topic,
    made me in my opinion consider it from numerous varied angles.
    Its like men and women aren’t fascinated except it is one
    thing to do with Lady gaga! Your personal stuffs excellent.
    At all times care for it up!

  15. Greetings, I think your blog could possibly be having internet browser compatibility issues.
    Whenever I look at your web site in Safari, it looks fine but when opening in Internet Explorer, it
    has some overlapping issues. I just wanted to provide
    you with a quick heads up! Besides that, excellent website!

  16. magnificent issues altogether, you simply gained a new reader.

    What could you suggest in regards to your submit that you just made some days
    ago? Any positive?

  17. Good day! Do you know if they make any plugins to assist
    with Search Engine Optimization? I’m trying to
    get my blog to rank for some targeted keywords
    but I’m not seeing very good results. If you know of any please share.
    Thanks!

  18. Nice blog here! Also your website loads up very fast!
    What host are you using? Can I get your affiliate link to
    your host? I wish my website loaded up as fast as yours lol

  19. If some one desires to be updated with most recent technologies after that he must
    be go to see this website and be up to date all the time.

  20. 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
    waste your intelligence on just posting videos to
    your weblog when you could be giving us something informative to read?

  21. This is really interesting, You’re a very skilled blogger.
    I’ve joined your rss feed and look forward to seeking more of your wonderful post.

    Also, I have shared your website in my social networks!

  22. Oh my goodness! Awesome article dude! Many thanks, However I am going through issues with your RSS.
    I don’t know why I cannot join it. Is there anybody else having
    similar RSS problems? Anyone that knows the answer can you kindly respond?
    Thanks!!

  23. Nice post. I learn something new and challenging on blogs I
    stumbleupon every day. It will always be helpful to read articles from other authors and
    use a little something from their websites.

  24. Hey! Would you mind if I share your blog with my twitter group?
    There’s a lot of people that I think would really appreciate your content.
    Please let me know. Thank you

  25. We are a group of volunteers and opening a new scheme in our community.
    Your web site offered us with valuable information to work on. You’ve done an impressive job and our entire
    community will be grateful to you.

  26. Definitely believe that which you stated. Your favorite justification seemed to be on the web the easiest thing to be aware of.
    I say to you, I definitely get annoyed while people think about worries that they plainly
    don’t know about. You managed to hit the nail upon the top
    and defined out the whole thing without having side effect
    , people could take a signal. Will probably be
    back to get more. Thanks

  27. What’s Taking place i am new to this, I stumbled upon this I have found It
    positively helpful and it has helped me out
    loads. I am hoping to give a contribution & aid other customers like its aided me.
    Great job.

  28. I am really impressed along with your writing abilities as well as with the structure to your blog.
    Is this a paid subject or did you customize it yourself?
    Either way keep up the nice quality writing, it’s uncommon to look
    a great weblog like this one today..

Comments are closed.