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. We are a group of volunteers and opening a new scheme in our community.
    Your site provided us with valuable info to work
    on. You have done a formidable job and our whole community will be grateful to you.

  2. Great beat ! I wish to apprentice while you amend your web site,
    how can i subscribe for a weblog web site?
    The account aided me a acceptable deal. I had been tiny bit
    familiar of this your broadcast offered vivid transparent concept

  3. I’m extremely impressed with your writing skills as well as
    with the layout on your weblog. Is this a paid theme or did you customize it yourself?
    Either way keep up the excellent quality writing, it is rare to see a nice blog
    like this one nowadays.

  4. I have read some good stuff here. Definitely price bookmarking for revisiting.
    I wonder how a lot effort you set to create this type of magnificent informative web site.

  5. Its such as you read my mind! You seem to know a lot approximately this, like you wrote
    the e-book in it or something. I feel that you simply could do with
    some percent to power the message house a bit, but instead of
    that, that is wonderful blog. An excellent read. I’ll
    definitely be back.

  6. You actually make it seem so easy along with your presentation but I find
    this matter to be actually one thing which I think I’d
    never understand. It sort of feels too complex and extremely extensive for me.

    I am taking a look forward for your next post, I will try
    to get the cling of it!

  7. My partner and I stumbled over here coming from a different web
    page and thought I might check things out. I like what
    I see so now i’m following you. Look forward to going over your web page again.

  8. What’s Going down i am new to this, I stumbled upon this I
    have found It positively helpful and it has aided me out loads.

    I hope to contribute & aid other customers like its aided me.
    Good job.

  9. What’s up i am kavin, its my first occasion to commenting anyplace, when i read this post i thought i
    could also make comment due to this good paragraph.

  10. Appreciating the time and effort you put into your blog and in depth information you present.
    It’s nice to come across a blog every once in a while that isn’t the same outdated rehashed material.
    Great read! I’ve bookmarked your site and I’m adding your RSS feeds
    to my Google account.

  11. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your
    point. You clearly know what youre talking about, why
    throw away your intelligence on just posting videos to your weblog when you
    could be giving us something enlightening to
    read?

  12. Hi 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 formatting issue or something to do with browser compatibility
    but I thought I’d post to let you know. The style and design look great though!
    Hope you get the issue solved soon. Cheers

  13. Hi! Do you know if they make any plugins to help with SEO?
    I’m trying to get my blog to rank for some targeted keywords but
    I’m not seeing very good success. If you know of any please share.
    Appreciate it!

  14. Hi to every one, since I am actually keen of reading this webpage’s post to be updated regularly.
    It contains nice information.

  15. Link exchange is nothing else but it is only placing the other
    person’s weblog link on your page at appropriate place and other person will also do similar in favor
    of you.

  16. Hello, I think your blog might be having browser compatibility issues.
    When I look at your blog in Ie, it looks fine but
    when opening in Internet Explorer, it has some overlapping.

    I just wanted to give you a quick heads up! Other then that, very good blog!

  17. you’re in point of fact a just right webmaster. The site loading
    speed is incredible. It kind of feels that you are doing any unique trick.
    Moreover, The contents are masterwork. you have done a wonderful activity on this topic!

  18. Right here is the right web site for everyone who would like to understand this
    topic. You realize so much its almost tough to argue with you (not that I personally would want to…HaHa).
    You certainly put a fresh spin on a subject that’s been written about for many years.

    Excellent stuff, just wonderful!

  19. Hello, i think that i saw you visited my weblog thus i came to go back
    the favor?.I am trying to in finding things to improve my web site!I assume
    its ok to use a few of your concepts!!

  20. My relatives all the time say that I am wasting my time here at web, however I know I
    am getting know-how all the time by reading thes pleasant articles.

  21. Hello, this weekend is pleasant for me, for the reason that this occasion i am reading this wonderful informative
    piece of writing here at my residence.

Comments are closed.