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. Yesterday, while I was at work, my cousin stole my iPad and tested to see if it
    can survive a twenty five foot drop, just so she can be a youtube sensation. My
    apple ipad is now broken and she has 83 views. I know this is entirely off topic but I had to share it with someone!

  2. If some one wishes expert view about running a blog after that
    i advise him/her to pay a quick visit this blog, Keep up the nice work.

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

    I mean, what you say is fundamental and all. However just imagine if you added
    some great visuals or videos to give your posts
    more, “pop”! Your content is excellent but with pics and video clips, this
    blog could definitely be one of the most beneficial in its niche.
    Amazing blog!

  4. I’m not sure exactly why but this weblog is loading very slow
    for me. Is anyone else having this problem or is it a problem on my end?
    I’ll check back later on and see if the problem still exists.

  5. I’ve been browsing online more than 4 hours today, yet I never found any
    interesting article like yours. It is pretty worth enough for me.
    In my view, if all site owners and bloggers made good content as you did, the web will be
    a lot more useful than ever before.

  6. Its like you read my mind! You appear to know so much 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 little bit, but instead of that, this is wonderful blog.
    A fantastic read. I will definitely be back.

  7. I’ve been exploring for a bit for any high-quality articles or blog posts on this
    sort of house . Exploring in Yahoo I at last stumbled upon this web site.
    Studying this information So i’m satisfied to express that
    I have an incredibly good uncanny feeling I came upon just what I needed.
    I most without a doubt will make sure to do not fail to remember this
    web site and give it a look regularly.

  8. It is appropriate time to make a few plans for the long run and it is time
    to be happy. I’ve learn this post and if I may I want to
    suggest you few attention-grabbing things or advice. Perhaps you
    can write next articles regarding this article. I desire to learn more issues about it!

  9. Helpful info. Fortunate me I found your web site by accident, and I am stunned why this twist of fate did
    not took place earlier! I bookmarked it.

  10. great points altogether, you just won a new reader.
    What could you suggest about your publish that you made some days ago?

    Any positive?

  11. What’s Going down i am new to this, I stumbled upon this I’ve found It positively helpful and it has aided me
    out loads. I am hoping to contribute & assist other users like its helped me.
    Good job.

  12. I think the admin of this web site is actually working hard for his site, since here every data is quality based information.

  13. wonderful submit, very informative. I ponder why the other experts of
    this sector don’t notice this. You should continue
    your writing. I am confident, you have a huge readers’ base already!

  14. Hello! I’m at work browsing your blog from my new iphone 3gs!
    Just wanted to say I love reading through your blog and look forward to all your posts!
    Keep up the outstanding work!

  15. I have read so many articles on the topic of the blogger lovers but
    this paragraph is truly a fastidious piece of writing, keep it up.

  16. An intriguing discussion is worth comment. I do believe that you should publish more about this topic, it might not be a taboo matter but
    usually people don’t discuss such subjects. To the next!
    All the best!!

  17. An intriguing discussion is definitely worth comment.

    There’s no doubt that that you should write more on this topic, it may not be
    a taboo matter but usually people don’t discuss such issues.
    To the next! Best wishes!!

  18. 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 some pics to drive the message home a bit, but instead
    of that, this is magnificent blog. A great read.
    I’ll definitely be back.

  19. Pretty section of content. I just stumbled upon your web site and in accession capital to assert that I
    acquire in fact enjoyed account your blog posts.
    Anyway I’ll be subscribing to your feeds and even I achievement you access consistently rapidly.

  20. I have read so many content on the topic of the blogger lovers but this post is
    in fact a fastidious post, keep it up.

  21. Magnificent beat ! I would like to apprentice while you amend your web site, how can i subscribe for
    a blog web site? The account helped me a acceptable
    deal. I had been a little bit acquainted of this your broadcast provided bright clear concept

Comments are closed.