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. hello there and thank you for your info – I’ve certainly picked up anything new from right
    here. I did however expertise several technical issues using this website,
    as I experienced to reload the web site a lot of times previous to I could get it
    to load properly. I had been wondering if your web
    host is OK? Not that I’m complaining, but sluggish loading
    instances times will often affect your placement in google and
    could damage your high quality score if ads and marketing with Adwords.
    Anyway I’m adding this RSS to my email and could look out for much more of your respective fascinating content.
    Ensure that you update this again very soon.

  2. Asking questions are truly good thing if you are not
    understanding something totally, except this paragraph gives fastidious understanding yet.

  3. Thanks for any other informative web site. The place else could I get that kind of info
    written in such an ideal approach? I have a undertaking that I am just now running on, and I have been at the glance out for such info.

  4. It is the best time to make some plans for the future and it’s time to be happy.
    I’ve read this post and if I could I want to suggest you few interesting things
    or suggestions. Perhaps you could write next articles referring to this article.

    I wish to read even more things about it!

  5. Howdy! Quick question that’s entirely off topic.

    Do you know how to make your site mobile friendly?
    My web site looks weird when browsing from my iphone.
    I’m trying to find a template or plugin that might be
    able to fix this problem. If you have any suggestions, please share.
    Many thanks!

  6. Its like you read my thoughts! You seem to understand
    so much approximately this, such as you wrote the book in it or something.
    I feel that you simply can do with some % to force the message home a little bit, but other than that, that is excellent blog.
    A fantastic read. I will certainly be back.

  7. You could definitely see your enthusiasm in the work
    you write. The world hopes for even more passionate writers such as you who are not afraid to say how
    they believe. Always follow your heart.

  8. Heya i am for the first time here. I came across this board
    and I to find It really useful & it helped me out a lot.
    I’m hoping to give something back and help others like you aided me.

  9. Hello, i think that i noticed you visited my weblog so i got here to go back the prefer?.I am attempting
    to find things to improve my web site!I guess its adequate to use a
    few of your ideas!!

  10. Hello! This is my first visit to your blog! We are a collection of volunteers
    and starting a new project in a community in the same niche.
    Your blog provided us useful information to work on. You have done a
    marvellous job!

  11. It’s in point of fact a nice and useful piece of info.
    I am satisfied that you simply shared this useful information with us.

    Please keep us up to date like this. Thank you for sharing.

  12. Do you mind if I quote a couple of your posts as long
    as I provide credit and sources back to your blog?
    My blog site is in the exact same area of interest as yours and my visitors would
    truly benefit from a lot of the information you present here.
    Please let me know if this alright with you.
    Regards!

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

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

  15. Its not my first time to pay a quick visit this website, i am browsing this site dailly and
    obtain good data from here everyday.

  16. Have you ever thought about creating an ebook or guest
    authoring on other blogs? I have a blog centered on the same topics you
    discuss and would love to have you share some stories/information. I know my subscribers would value your work.
    If you are even remotely interested, feel free to send
    me an email.

  17. I do not know if it’s just me or if perhaps everybody else encountering issues with your site.
    It seems like some of the written text in your content are running off the screen. Can somebody else please provide feedback
    and let me know if this is happening to them too? This might
    be a issue with my web browser because I’ve had this happen before.
    Thank you

  18. Today, I went to the beach 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 totally off topic but I had to tell someone!

  19. I just could not leave your website before suggesting that I actually enjoyed the standard info an individual provide on your visitors?
    Is going to be back steadily in order to check up on new posts

  20. My spouse and I absolutely love your blog and find most of your post’s to be just what
    I’m looking for. Does one offer guest writers to write
    content for yourself? I wouldn’t mind publishing a post or elaborating on some of the subjects you write
    related to here. Again, awesome site!

  21. I like the valuable information you provide in your articles.
    I’ll bookmark your blog and check again here frequently. I’m quite certain I will learn many new stuff right here!
    Best of luck for the next!

  22. I wanted to thank you for this very good read!!
    I certainly enjoyed every little bit of it. I have got you book-marked to look at
    new stuff you post…

  23. Oh my goodness! Incredible article dude! Thank you so much, However
    I am encountering difficulties with your RSS. I don’t understand
    why I cannot join it. Is there anyone else getting similar RSS issues?
    Anyone that knows the answer will you kindly respond? Thanks!!

  24. Hmm it seems like your site ate my first comment (it was extremely long) so I guess I’ll just sum it
    up what I submitted and say, I’m thoroughly enjoying your blog.
    I too am an aspiring blog writer but I’m still new to everything.
    Do you have any helpful hints for novice blog writers?
    I’d definitely appreciate it.

  25. We’re a group of volunteers and opening a brand new scheme in our community.
    Your web site offered us with valuable information to work on. You have done an impressive
    task and our whole neighborhood can be grateful to you.

  26. I like the helpful info you supply for your articles.
    I will bookmark your weblog and take a look at again here frequently.
    I am reasonably sure I will learn many new stuff proper right here!
    Best of luck for the following!

  27. Hello there, I found your website by way of Google whilst looking for a
    comparable subject, your site got here up, it appears to be like great.

    I have bookmarked it in my google bookmarks.
    Hello there, simply became alert to your blog through Google,
    and found that it’s truly informative. I am gonna
    be careful for brussels. I will be grateful for those who proceed this
    in future. Many people shall be benefited out of your writing.
    Cheers!

  28. Hello! I could have sworn I’ve been to this site before but after browsing through some of the post I realized it’s new to me.
    Nonetheless, I’m definitely happy I found it and I’ll be bookmarking and checking
    back often!

  29. An intriguing discussion is worth comment. There’s no doubt that that you should publish more about this issue, it might not be a taboo matter but typically people do not discuss such issues.
    To the next! Best wishes!!

Comments are closed.