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.

17,247 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. Somebody necessarily assist to make severely articles I might state.

    This is the first time I frequented your web page and to this point?
    I amazed with the research you made to make this particular post extraordinary.
    Excellent job!

  2. Have you ever thought about including a little bit more than just your articles?
    I mean, what you say is important and everything. Nevertheless imagine if
    you added some great pictures or videos to give your
    posts more, “pop”! Your content is excellent but with pics and
    videos, this site could undeniably be one of the greatest in its niche.
    Good blog!

  3. Have you ever considered about including a little bit more
    than just your articles? I mean, what you say is important and all.
    But just imagine if you added some great images or video clips to give your posts more, “pop”!

    Your content is excellent but with images and clips, this site could
    undeniably be one of the most beneficial in its field. Wonderful blog!

  4. Its such as you read my thoughts! You appear to grasp a lot about this,
    such as you wrote the e book in it or something. I believe that you just could do with some %
    to pressure the message home a little bit, but other than that, this is magnificent blog.
    An excellent read. I will definitely be back.

  5. Hey 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
    results.

  6. Hi there! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized
    it’s new to me. Anyways, I’m definitely glad I found it and I’ll be bookmarking and checking back frequently!

  7. I have been exploring for a little for any high quality articles or weblog posts in this kind
    of house . Exploring in Yahoo I at last stumbled upon this
    web site. Reading this information So i’m satisfied to show that I have
    a very good uncanny feeling I discovered just what I needed.
    I such a lot indubitably will make certain to do not forget this web site and provides it a look regularly.

  8. Yesterday, while I was at work, my sister stole my apple ipad and
    tested to see if it can survive a forty foot drop, just so she can be a youtube sensation. My
    iPad is now destroyed and she has 83 views. I know this is completely off topic
    but I had to share it with someone!

  9. Very great post. I just stumbled upon your weblog and wished to mention that I have truly
    loved surfing around your blog posts. In any case I will be subscribing for
    your rss feed and I hope you write once more very soon!

  10. I was curious if you ever considered changing the layout of your blog?
    Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better.
    Youve got an awful lot of text for only having
    one or 2 images. Maybe you could space it out
    better?

  11. Greetings from Carolina! I’m bored to tears at work so I decided to check out your blog on my iphone during lunch break.

    I love the info you provide here and can’t wait to take
    a look when I get home. I’m amazed at how fast your blog loaded on my
    mobile .. I’m not even using WIFI, just 3G ..

    Anyways, very good blog!

  12. An interesting discussion is definitely worth comment.
    I believe that you should write more on this issue, it may not be
    a taboo subject but generally people don’t discuss these topics.
    To the next! All the best!!

  13. Hello! I just wanted to ask if you ever have any issues
    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?

  14. Excellent way of explaining, and fastidious piece of writing to get information on the topic of my presentation subject matter, which i am going to
    convey in college.

  15. Yesterday, while I was at work, my sister stole my
    iPad and tested to see if it can survive a 30 foot drop,
    just so she can be a youtube sensation. My iPad is now broken and she has 83 views.
    I know this is completely off topic but I
    had to share it with someone!

  16. You could definitely see your skills in the article you write.
    The sector hopes for more passionate writers such as you who aren’t afraid to mention how they believe.
    All the time go after your heart.

  17. Hi, this weekend is pleasant in favor of me, for the reason that this moment i am reading this enormous informative post
    here at my house.

  18. Its like you read my mind! You appear to know a
    lot about this, like you wrote the book in it or something.
    I think that you could do with some pics to drive the
    message home a bit, but instead of that, this is excellent blog.

    A great read. I’ll certainly be back.

  19. Have you ever considered about including a little bit more than just your articles?

    I mean, what you say is important and all.
    Nevertheless think of if you added some great pictures or videos to give your posts more,
    “pop”! Your content is excellent but with pics and videos, this blog could
    definitely be one of the greatest in its
    field. Great blog!

  20. We are a group of volunteers and opening a brand new scheme
    in our community. Your site provided us with helpful
    information to work on. You have done a formidable job and
    our entire community can be grateful to you.

  21. Does your blog have a contact page? I’m having trouble locating it
    but, I’d like to shoot you an e-mail. 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.

  22. Hello, 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 remarks?
    If so how do you prevent it, any plugin or anything you can advise?

    I get so much lately it’s driving me mad so any help is very much appreciated.

  23. Hi, I do believe this is an excellent site. I stumbledupon it
    😉 I may revisit once again since I bookmarked it.

    Money and freedom is the greatest way to change, may you be rich and continue
    to guide other people.

  24. 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!

Comments are closed.