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 for … in.

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,626 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku”

  1. Hi just wanted to give you a brief heads up and let you
    know a few of the images aren’t loading correctly.
    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 results.

  2. Hi would you mind letting me know which web host you’re working with?
    I’ve loaded your blog in 3 different browsers and I must say this blog loads
    a lot quicker then most. Can you suggest a good internet hosting provider at a reasonable
    price? Cheers, I appreciate it!

  3. An intriguing discussion is definitely worth comment.
    There’s no doubt that that you should publish more about
    this topic, it may not be a taboo matter but usually people don’t talk about such topics.
    To the next! Best wishes!!

  4. With havin so much content do you ever run into any
    issues of plagorism or copyright violation? My blog has a lot of
    completely unique content I’ve either created myself or outsourced but it seems a lot of it is
    popping it up all over the internet without my agreement. Do you know any solutions
    to help protect against content from being ripped off?

    I’d truly appreciate it.

  5. Hi, I do believe this is a great web site. I stumbledupon it 😉 I’m going to revisit yet again since i have saved as
    a favorite it. Money and freedom is the greatest way to
    change, may you be rich and continue to guide other people.

  6. I have read several excellent stuff here. Certainly worth bookmarking for revisiting.

    I wonder how much attempt you set to make one of these magnificent informative web site.

  7. Terrific post however I was wondering if you could write a litte more on this subject?
    I’d be very grateful if you could elaborate a little bit further.
    Bless you!

  8. Pretty nice post. I just stumbled upon your blog and
    wished to say that I have truly enjoyed browsing your blog posts.
    After all I will be subscribing to your feed and I hope you
    write again very soon!

  9. Someone necessarily help to make seriously articles I’d
    state. That is the very first time I frequented your web page and to this point?
    I surprised with the research you made to make this particular publish incredible.
    Great activity!

  10. You actually make it seem so easy with your presentation but I find this topic to be actually one thing which I
    feel I would by no means understand. It seems too complex and extremely broad for me.
    I’m having a look forward in your next put up, I’ll attempt to
    get the hold of it!

  11. 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 several emails with the same
    comment. Is there any way you can remove me from that service?

    Bless you!

  12. Currently it sounds like Drupal is the preferred blogging platform out
    there right now. (from what I’ve read) Is that what you’re
    using on your blog?

  13. I loved as much as you will receive carried out right here.
    The sketch is tasteful, your authored subject
    matter stylish. nonetheless, you command get bought an shakiness over that you wish be delivering the
    following. unwell unquestionably come further formerly again as exactly the
    same nearly very often inside case you shield this increase.

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

  15. Having read this I thought it was extremely informative.
    I appreciate you spending some time and energy to put this short article together.
    I once again find myself personally spending way too
    much time both reading and leaving comments. But so what, it was still worth it!

  16. It is not my first time to pay a visit this web page, i am browsing this web page
    dailly and get fastidious information from here all the time.

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

  18. What i do not realize is in fact how you’re now not actually a lot more smartly-favored than you may be right now.

    You are very intelligent. You realize thus considerably in terms of this topic, made me individually believe it from numerous various angles.
    Its like women and men are not interested until it is one thing to accomplish with Girl gaga!
    Your personal stuffs excellent. All the time deal with it up!

  19. Its not my first time to pay a visit this web page, i am browsing this web site dailly
    and obtain nice data from here daily.

  20. You can definitely see your enthusiasm in the work you write.
    The arena hopes for even more passionate
    writers such as you who are not afraid to say how they believe.
    At all times follow your heart.

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

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

Comments are closed.