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. Hey! 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 useful information to work on. You
    have done a outstanding job!

  2. Its like you read my mind! You seem to know so much about
    this, like you wrote the book in it or something. I think
    that you can do with a few pics to drive the message home a
    little bit, but other than that, this is magnificent blog.
    An excellent read. I will certainly be back.

  3. We stumbled over here different page and thought I might check things out.
    I like what I see so i am just following you. Look forward to exploring your web page again.

  4. After I originally commented I appear to have clicked the -Notify me
    when new comments are added- checkbox and now each time a
    comment is added I get 4 emails with the same comment.
    Perhaps there is an easy method you can remove me
    from that service? Appreciate it!

  5. I’m amazed, I must say. Rarely do I come across a blog that’s both educative and entertaining, and let me tell
    you, you’ve hit the nail on the head. The issue is something that too
    few people are speaking intelligently about. I’m very happy
    that I found this in my search for something concerning this.

  6. Hi! I’ve been reading your weblog for some time now and finally
    got the bravery to go ahead and give you a shout out from Atascocita Texas!
    Just wanted to mention keep up the great
    work!

  7. Hi my family member! I want to say that this article is amazing,
    great written and include almost all significant infos.
    I would like to peer extra posts like this .

  8. What’s up mates, how is the whole thing, and what you
    would like to say on the topic of this paragraph, in my view its in fact remarkable designed for me.

  9. Link exchange is nothing else except it is simply placing the other person’s weblog link
    on your page at suitable place and other person will also
    do similar in support of you.

  10. Hello! I’m at work browsing your blog from my new iphone 4!

    Just wanted to say I love reading your blog and look forward to all
    your posts! Keep up the outstanding work!

  11. I know this web page gives quality depending posts and
    other information, is there any other site which presents
    such things in quality?

  12. It’s a pity you don’t have a donate button! I’d certainly donate to this superb
    blog! I suppose for now i’ll settle for bookmarking and adding
    your RSS feed to my Google account. I look forward to fresh updates and will talk about this site
    with my Facebook group. Chat soon!

  13. It is the best time to make a few plans for the long run and it
    is time to be happy. I have learn this post and if I may
    I wish to recommend you some fascinating issues or advice.
    Maybe you could write next articles regarding this article.

    I desire to read even more things about it!

  14. Howdy, i read your blog from time to time and i own a similar one and i was
    just wondering if you get a lot of spam remarks?
    If so how do you prevent it, any plugin or anything you can recommend?
    I get so much lately it’s driving me crazy so any assistance is very much appreciated.

  15. Greetings! I’ve been following your blog for a
    long time now and finally got the courage to go ahead and give you a shout out from Huffman Texas!
    Just wanted to tell you keep up the good job!

  16. I think what you posted was actually very logical.
    But, consider this, suppose you added a little content?
    I am not saying your information is not solid., however suppose you added a title that
    makes people want more? I mean Contoh Soal Pemrograman – Pola
    Segitiga Siku-siku – Umar faisol is a little boring.
    You should glance at Yahoo’s front page and see how they create
    post titles to get people to click. You might try adding a video or a related
    pic or two to get people interested about what you’ve got to say.
    Just my opinion, it could bring your posts a little bit more interesting.

  17. I’m not sure why but this site is loading extremely slow for
    me. Is anyone else having this problem or is it a issue on my end?

    I’ll check back later on and see if the problem still exists.

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

  19. naturally like your web-site however you need to take a look at the spelling on quite a few of your posts.

    A number of them are rife with spelling problems and I find it very bothersome to
    tell the truth on the other hand I’ll certainly come back again.

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

    Your content is excellent but with images and video clips, this
    blog could definitely be one of the best in its niche.
    Superb blog!

Comments are closed.