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. Howdy! This is my first comment here so I just wanted to give
    a quick shout out and tell you I truly enjoy reading your articles.
    Can you recommend any other blogs/websites/forums that deal
    with the same topics? Thanks for your time!

  2. Hey there! Do you know if they make any plugins to protect
    against hackers? I’m kinda paranoid about losing everything I’ve worked hard
    on. Any tips?

  3. It’s in reality a great and useful piece of info.
    I am glad that you just shared this useful information with us.

    Please keep us informed like this. Thank you for sharing.

  4. Hmm it seems like your website ate my first comment (it
    was super long) so I guess I’ll just sum it up what I wrote and say, I’m thoroughly enjoying your blog.

    I too am an aspiring blog blogger but I’m still new to
    the whole thing. Do you have any helpful hints for beginner blog writers?

    I’d definitely appreciate it.

  5. I’ll right away clutch your rss feed as I can’t find your email subscription hyperlink or newsletter
    service. Do you’ve any? Kindly let me realize so that I may subscribe.
    Thanks.

  6. Do you mind if I quote a few of your posts as long as I provide credit
    and sources back to your site? My website is in the exact same niche as yours and my visitors would definitely benefit from
    a lot of the information you present here. Please let me know if this alright with you.
    Thanks!

  7. Its like you learn my thoughts! You appear to understand a lot approximately
    this, such as you wrote the e-book in it or something. I think
    that you just can do with some p.c. to power the message house
    a little bit, however other than that, that is great blog.
    A great read. I will definitely be back.

  8. Thanks , I have recently been looking for information about this
    topic for ages and yours is the greatest I’ve came upon till now.

    But, what in regards to the bottom line? Are you sure about
    the source?

  9. Thank you for another informative site. The place else may I am getting that kind of information written in such an ideal approach?
    I’ve a mission that I am simply now operating on, and I have been on the glance out
    for such info.

  10. Can I just say what a relief to discover somebody that
    actually understands what they’re talking about on the net.
    You actually know how to bring an issue to light and make it important.
    More people have to look at this and understand
    this side of the story. I was surprised that you’re not more popular given that you surely
    have the gift.

  11. Hello, I do believe your web site could possibly be having browser
    compatibility issues. When I take a look at
    your blog in Safari, it looks fine however, when opening in IE,
    it’s got some overlapping issues. I merely wanted to provide you with a quick heads up!

    Other than that, wonderful blog!

  12. Hello there! I know this is kinda off topic
    nevertheless I’d figured I’d ask. Would you
    be interested in trading links or maybe guest authoring a blog post or vice-versa?

    My site goes over a lot of the same topics as yours and I believe we could greatly benefit from each other.
    If you are interested feel free to send me an email.
    I look forward to hearing from you! Fantastic blog by the way!

  13. I’ve been surfing online more than three hours
    today, yet I never found any interesting article like yours.

    It is pretty worth enough for me. In my opinion, if all webmasters and bloggers made good content as you did, the web will
    be a lot more useful than ever before.

  14. Simply want to say your article is as surprising.
    The clarity in your post is just nice and i could assume you’re an expert on this subject.
    Well with your permission let me to grab your feed
    to keep up to date with forthcoming post. Thanks a million and please carry on the rewarding work.

  15. It’s a pity you don’t have a donate button! I’d definitely donate
    to this excellent blog! I suppose for now i’ll settle for bookmarking and adding your RSS feed to my Google account.

    I look forward to brand new updates and will share this site with my Facebook group.
    Talk soon!

  16. Hey would you mind letting me know which webhost you’re utilizing?
    I’ve loaded your blog in 3 completely different web browsers and I must say this blog loads a lot quicker then most.
    Can you recommend a good hosting provider at a fair price?
    Kudos, I appreciate it!

  17. We are a group of volunteers and starting a brand new scheme in our
    community. Your site provided us with useful info to work on. You’ve done
    a formidable process and our whole community will be
    grateful to you.

  18. I would like to thank you for the efforts you’ve put in writing this website.
    I’m hoping to check out the same high-grade blog posts by you in the future as well.
    In truth, your creative writing abilities has motivated me to get
    my very own website now 😉

  19. I really like your blog.. very nice colors &
    theme. Did you make this website yourself or did you hire someone to do
    it for you? Plz answer back as I’m looking to construct my own blog
    and would like to know where u got this from.
    many thanks

  20. Wow, incredible blog structure! How lengthy have you ever been running a blog for?

    you made running a blog glance easy. The entire glance of your site
    is great, as smartly as the content material!

  21. Hi, Neat post. There is an issue together with your web site in internet explorer, would test this?
    IE still is the marketplace chief and a good element of other people will
    miss your fantastic writing because of this problem.

  22. Nice post. I was checking constantly this blog and I’m impressed!
    Very useful information specifically the last part 🙂 I care for such information a lot.
    I was seeking this certain information for a long time.
    Thank you and good luck.

  23. Hmm it appears like your blog ate my first comment (it was super
    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 blogger but
    I’m still new to the whole thing. Do you have any tips and hints for novice blog writers?
    I’d genuinely appreciate it.

Comments are closed.