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.

48,210 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. Does your site have a contact page? I’m having a tough time 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
    grow over time.

  2. 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 suggest?
    I get so much lately it’s driving me crazy so any help is very much appreciated.

  3. Heya! I just wanted to ask if you ever have any trouble with hackers?
    My last blog (wordpress) was hacked and I ended up losing months of hard work due to no back up.
    Do you have any solutions to stop hackers?

  4. This design is wicked! You obviously know how to keep a reader amused.
    Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Wonderful job.
    I really enjoyed what you had to say, and more than that, how
    you presented it. Too cool!

  5. This is very attention-grabbing, You are an overly professional blogger.
    I’ve joined your feed and look forward to in quest of more of your great post.
    Additionally, I’ve shared your web site in my social networks

  6. We stumbled over here different page and thought I might as well check things out.
    I like what I see so now i’m following you. Look forward to exploring your web page yet again.

  7. My brother suggested I might like this web site.

    He was entirely right. This post truly made my day.
    You can not imagine just how much time I had spent for this info!
    Thanks!

  8. Woah! I’m really enjoying the template/theme of this website.
    It’s simple, yet effective. A lot of times it’s tough to get that “perfect balance” between usability and
    visual appeal. I must say you’ve done a great job with this.
    Also, the blog loads extremely quick for me on Opera.
    Exceptional Blog!

  9. Hey there! Someone in my Facebook group shared this site with us so I came to look it over.

    I’m definitely loving the information. I’m bookmarking and will be tweeting this to my followers!
    Excellent blog and excellent design.

  10. 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?
    Many thanks!

  11. I am no longer positive the place you are getting your info,
    but great topic. I must spend a while finding out more or understanding more.
    Thank you for wonderful info I used to be searching for this
    info for my mission.

  12. Its like you learn my thoughts! You seem to know so
    much approximately this, like you wrote the book in it or something.
    I feel that you just could do with a few p.c. to power the message house a bit,
    however other than that, that is magnificent blog. A fantastic read.
    I will definitely be back.

  13. An impressive share! I’ve just forwarded this onto a friend who was doing a little
    homework on this. And he actually ordered me lunch because I discovered it
    for him… lol. So let me reword this…. Thank YOU for the meal!!
    But yeah, thanks for spending the time to talk about
    this subject here on your web page.

  14. I am extremely inspired along with your writing skills and also with the structure in your weblog.
    Is that this a paid subject or did you modify it yourself?
    Anyway keep up the excellent quality writing, it’s uncommon to peer a great blog like
    this one these days..

  15. Terrific post however , I was wanting to know if you could write a litte more on this subject?
    I’d be very thankful if you could elaborate a little bit more.

    Many thanks!

  16. What i don’t understood is if truth be told how you’re no
    longer really much more well-favored than you might be right
    now. You are very intelligent. You understand therefore significantly relating
    to this topic, produced me for my part consider it from so many
    various angles. Its like men and women aren’t involved unless it is one thing to do with Woman gaga!

    Your own stuffs outstanding. All the time
    take care of it up!

  17. Hi there, I found your web site via Google at the same time as looking for a comparable matter, your website got here up, it seems
    good. I have bookmarked it in my google bookmarks.

    Hi there, just changed into aware of your blog through Google, and
    found that it’s really informative. I’m gonna watch out for brussels.
    I’ll be grateful for those who proceed this {in future}.
    Many people might be benefited from your writing.
    Cheers!

  18. Howdy, i read your blog occasionally and i own a similar one
    and i was just wondering if you get a lot of spam comments?

    If so how do you reduce it, any plugin or anything you can recommend?
    I get so much lately it’s driving me crazy so any help is very much appreciated.

  19. I seriously love your website.. Pleasant colors & theme.
    Did you create this amazing site yourself? Please reply back as I’m wanting
    to create my very own blog and would love to know where you got
    this from or exactly what the theme is named. Appreciate
    it!

  20. Your method of describing the whole thing in this paragraph
    is genuinely pleasant, every one can simply know it, Thanks a lot.

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

  22. I just like the helpful information you supply on your articles.
    I will bookmark your weblog and test once more right
    here regularly. I am quite certain I’ll be told many new stuff proper
    right here! Best of luck for the following!

  23. Hi there! I realize this is kind of off-topic however I had to ask.
    Does running a well-established website like yours require a lot of work?
    I’m brand new to running a blog but I do write in my journal on a daily basis.
    I’d like to start a blog so I will be able to share my personal experience and views online.
    Please let me know if you have any ideas or tips for new aspiring blog owners.
    Thankyou!

  24. Greetings! I know this is kinda off topic however , I’d figured
    I’d ask. Would you be interested in trading links
    or maybe guest writing a blog article or vice-versa? My blog goes
    over a lot of the same subjects as yours and I believe we could greatly benefit from each other.
    If you might be interested feel free to send me an e-mail.
    I look forward to hearing from you! Superb blog by the way!

  25. Woah! I’m really loving the template/theme of this blog.
    It’s simple, yet effective. A lot of times it’s difficult to get that “perfect balance” between usability and visual appearance.
    I must say you have done a great job with this. Additionally, the blog loads very fast for me on Internet explorer.
    Exceptional Blog!

Comments are closed.