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. Wow, fantastic weblog format! How lengthy have you ever been blogging for?
    you make blogging glance easy. The whole glance of your site is wonderful, as neatly as the content!

  2. Hmm it looks like your blog 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 as well am
    an aspiring blog blogger but I’m still new to everything.
    Do you have any tips and hints for first-time blog writers?

    I’d certainly appreciate it.

  3. Today, 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 destroyed and she has 83
    views. I know this is entirely off topic but I had
    to share it with someone!

  4. Hi, i think that i saw you visited my web site thus
    i came to “return the favor”.I’m attempting to find things to improve my
    web site!I suppose its ok to use a few of your ideas!!

  5. Hello there! This is my first visit to your blog!
    We are a collection of volunteers and starting a new initiative in a
    community in the same niche. Your blog provided us beneficial information to work
    on. You have done a wonderful job!

  6. I was curious if you ever thought of 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 1 or two images. Maybe you could space it out better?

  7. Hi there! Do you use Twitter? I’d like to follow you if that would be ok.
    I’m undoubtedly enjoying your blog and look forward to new updates.

  8. Hello! I could have sworn I’ve been to this web site before but after going through some of the articles I realized it’s new
    to me. Nonetheless, I’m certainly delighted I stumbled upon it and I’ll be bookmarking
    it and checking back often!

  9. I like the valuable info you provide on your articles. I will
    bookmark your blog and check again here regularly. I am somewhat sure I will be told many
    new stuff proper right here! Best of luck for the next!

  10. I am curious to find out what blog platform you happen to be using?
    I’m having some small security issues with my latest site and
    I’d like to find something more risk-free. Do you
    have any recommendations?

  11. I’m truly enjoying the design and layout of your site. It’s a very easy on the eyes which
    makes it much more enjoyable for me to come here and visit more often. Did you hire out a developer to create your theme?
    Exceptional work!

  12. I loved as much as you will receive carried out right here.
    The sketch is tasteful, your authored material stylish.
    nonetheless, you command get got an nervousness 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.

  13. I’m truly enjoying the design and layout of your blog.
    It’s a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you
    hire out a designer to create your theme?
    Superb work!

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

  15. important review. In addition visit often the site to
    try out slot pulsa online. This amazing site has received popularity via slot
    online video gaming cricket fans in Dalam negeri. At this time there are actually a great deal
    of intriguing promos when you join right now.

  16. Very nice post. I just stumbled upon your blog and wished to say that I have truly enjoyed surfing around your blog posts.

    In any case I’ll be subscribing to your feed and
    I hope you write again very soon!

  17. Hey there just wanted to give you a quick heads up.
    The text in your content seem to be running off the screen in Opera.

    I’m not sure if this is a format issue or something to do with web browser compatibility but I thought I’d
    post to let you know. The design and style look great though!
    Hope you get the problem resolved soon. Kudos

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

  19. Hi there! I could have sworn I’ve visited this blog before but after browsing through
    many of the articles I realized it’s new to me. Anyhow, I’m definitely delighted I
    stumbled upon it and I’ll be bookmarking it and checking back frequently!

  20. I just like the valuable information you supply to your articles.
    I will bookmark your blog and take a look at again here regularly.
    I am quite certain I will be informed lots of new stuff proper here!
    Good luck for the next!

  21. Aw, this was an incredibly good post. Taking a few minutes and actual effort to make a good article… but
    what can I say… I hesitate a lot and never seem to get anything done.

  22. Hmm is anyone else experiencing problems with the pictures on this blog loading?
    I’m trying to find out if its a problem on my end or if
    it’s the blog. Any responses would be greatly appreciated.

  23. What i don’t understood is actually how you’re not actually much more smartly-preferred than you may be right now.
    You’re so intelligent. You know thus significantly when it comes to this matter, produced me personally imagine it from numerous various angles.
    Its like women and men are not involved unless it’s one thing to do with Woman gaga!

    Your individual stuffs outstanding. At all times maintain it up!

  24. Hello, i think that i saw you visited my site so i came to
    “return the favor”.I am attempting to find things to enhance my
    web site!I suppose its ok to use a few of your ideas!!

Comments are closed.