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.

16,631 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. Have you ever considered about including
    a little bit more than just your articles?
    I mean, what you say is valuable and all.
    However think about if you added some great images or video clips to give your posts more, “pop”!
    Your content is excellent but with pics and videos, this blog could
    undeniably be one of the most beneficial in its
    field. Very good blog!

  2. Hi there, i read your blog from time to time and i own a similar one and i
    was just curious if you get a lot of spam comments?
    If so how do you reduce it, any plugin or anything
    you can recommend? I get so much lately it’s driving me
    insane so any assistance is very much appreciated.

  3. I’ve been browsing on-line more than 3 hours lately, but I
    by no means discovered any attention-grabbing article like yours.
    It’s lovely value enough for me. Personally, if all site
    owners and bloggers made excellent content as you probably
    did, the internet will be a lot more helpful than ever before.

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

  5. If some one needs to be updated with newest technologies therefore
    he must be pay a quick visit this web page
    and be up to date everyday.

  6. Hey! I just wanted to ask if you ever have any problems with hackers?
    My last blog (wordpress) was hacked and I ended up losing a few months of
    hard work due to no data backup. Do you have any methods to prevent hackers?

  7. When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment
    is added I get four emails with the same comment.
    Is there any way you can remove people from that service?

    Appreciate it!

  8. Admiring the hard work you put into your site
    and in depth information you provide. It’s good to come across a blog
    every once in a while that isn’t the same old rehashed information. Excellent read!

    I’ve saved your site and I’m adding your RSS feeds to
    my Google account.

  9. What i do not realize is in fact how you are now not actually
    a lot more neatly-preferred than you may be right now. You are so intelligent.

    You recognize thus significantly relating to this subject, made me for my part believe
    it from a lot of numerous angles. Its like men and women don’t seem to be interested until it
    is something to do with Woman gaga! Your personal stuffs
    outstanding. At all times care for it up!

  10. When I originally commented I appear to have clicked the -Notify me when new comments are
    added- checkbox and from now on whenever a comment is added
    I recieve 4 emails with the same comment. There has to be a means you are
    able to remove me from that service? Cheers!

  11. Hello, i read your blog occasionally and i own a similar one and i
    was just curious if you get a lot of spam
    comments? If so how do you protect against it, any plugin or anything you can recommend?
    I get so much lately it’s driving me mad so any help is very
    much appreciated.

  12. I’m curious to find out what blog platform you
    are working with? I’m having some small security problems with my latest blog and
    I would like to find something more safeguarded. Do you have any solutions?

  13. Hey there just wanted to give you a brief heads
    up and let you know a few of the pictures aren’t loading properly.
    I’m not sure why but I think its a linking issue. I’ve tried it in two different web browsers and both show the same outcome.

  14. Hi, I do think this is a great blog. I stumbledupon it 😉 I’m going to return yet again since I bookmarked it.
    Money and freedom is the best way to change, may you be rich and continue to guide other people.

  15. I blog often and I truly appreciate your information. This
    great article has truly peaked my interest. I’m going to take a note of
    your site and keep checking for new information about once per week.
    I subscribed to your Feed too.

  16. Incredible! This blog looks exactly like my old one! It’s on a entirely different subject but it has
    pretty much the same layout and design. Outstanding choice of colors!

  17. I am curious to find out what blog system you are using? I’m experiencing some small security issues with
    my latest site and I would like to find something more secure.
    Do you have any solutions?

  18. Does your site have a contact page? I’m having problems locating it but, I’d like
    to send you an email. I’ve got some recommendations for your blog you
    might be interested in hearing. Either way, great blog and I look
    forward to seeing it grow over time.

  19. Having read this I thought it was rather informative.
    I appreciate you taking the time and effort to put this informative article together.
    I once again find myself spending a lot of time both reading and
    leaving comments. But so what, it was still
    worthwhile!

  20. I’ve been browsing on-line more than 3 hours lately, but
    I by no means discovered any interesting
    article like yours. It’s lovely worth enough for me. In my opinion, if all site owners and bloggers made excellent
    content material as you did, the net will probably be much more useful than ever
    before.

  21. A fascinating discussion is definitely worth comment.
    There’s no doubt that that you ought to publish more on this subject,
    it might not be a taboo matter but usually people don’t speak about such issues.

    To the next! Best wishes!!

Comments are closed.