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. Hello everyone, it’s my first go to see at this web site, and
    article is truly fruitful for me, keep up posting
    these types of articles or reviews.

  2. I like the helpful info you provide in your articles.
    I will bookmark your weblog and check again here frequently.

    I’m quite certain I’ll learn many new stuff right here!

    Good luck for the next!

  3. Hello! This is kind of off topic but I need some guidance from an established blog.
    Is it very hard to set up your own blog? I’m not very techincal but I can figure things out
    pretty quick. I’m thinking about creating my own but I’m not sure where to start.
    Do you have any tips or suggestions? Cheers

  4. Hey there! I realize this is kind of off-topic however
    I had to ask. Does managing a well-established blog such as yours take
    a large amount of work? I am brand new to blogging but I do write
    in my diary everyday. I’d like to start a blog so I can easily share my
    own experience and feelings online. Please let me know if
    you have any kind of recommendations or tips for brand new
    aspiring bloggers. Appreciate it!

  5. Good way of explaining, and fastidious post to obtain data concerning my
    presentation subject, which i am going to convey in university.

  6. Hello! I just wanted to ask if you ever have any problems with
    hackers? My last blog (wordpress) was hacked and I ended up losing a few months of hard work due to no data backup.
    Do you have any methods to protect against hackers?

  7. When some one searches for his necessary thing, so he/she desires
    to be available that in detail, therefore that thing is maintained over here.

  8. It’s appropriate time to make some plans for the long
    run and it is time to be happy. I have read this post and if
    I may just I want to suggest you some interesting issues or tips.
    Maybe you can write subsequent articles relating to this article.
    I want to learn more things about it!

  9. I’ve been browsing online more than 3 hours
    today, yet I never found any interesting article like yours.
    It’s pretty worth enough for me. Personally, if all webmasters and bloggers made good content as you did, the
    internet will be a lot more useful than ever before.

  10. I like the valuable info you provide in your articles.
    I’ll bookmark your blog and check again here frequently.
    I am quite certain I will learn plenty of new
    stuff right here! Best of luck for the next!

  11. Pretty component to content. I simply stumbled
    upon your blog and in accession capital to claim that I get actually loved account your weblog posts.
    Anyway I’ll be subscribing to your feeds or even I success
    you get entry to persistently fast.

  12. Today, I went to the beach front 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!

  13. I do not even know the way I finished up here, but I believed this put up was great.
    I don’t understand who you are however definitely you are going to
    a famous blogger when you are not already. Cheers!

  14. obviously like your web site however you have to check the spelling on several of your posts.
    Several of them are rife with spelling issues and I find it
    very troublesome to inform the reality nevertheless I’ll certainly
    come back again.

  15. Hey! Someone in my Myspace group shared this site with us so I came to
    take a look. I’m definitely loving the information. I’m bookmarking and will be tweeting this to
    my followers! Wonderful blog and excellent style and design.

  16. Hi there, all the time i used to check weblog posts here early in the morning, for the reason that i
    enjoy to gain knowledge of more and more.

  17. Its like you read my mind! You seem to know a
    lot about this, like you wrote the book in it or something.
    I think that you could do with a few pics to drive the message home a bit, but instead of that,
    this is wonderful blog. A great read. I will definitely be back.

  18. Hey there just wanted to give you a quick heads up and let you know a few of the images aren’t loading properly.
    I’m not sure why but I think its a linking issue.
    I’ve tried it in two different browsers and both show the same outcome.

  19. Hey just wanted to give you a quick heads up. The words in your post seem to be
    running off the screen in Chrome. I’m not sure if this is a format
    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 problem resolved soon. Cheers

  20. Have you ever thought about publishing an e-book or guest
    authoring on other blogs? I have a blog based upon on the same topics you discuss
    and would love to have you share some stories/information. I know my viewers would
    value your work. If you’re even remotely interested,
    feel free to shoot me an e-mail.

  21. Admiring the time and effort you put into your site and detailed information you offer.
    It’s good to come across a blog every once in a while
    that isn’t the same out of date rehashed information. Fantastic read!
    I’ve saved your site and I’m adding your
    RSS feeds to my Google account.

  22. I do not even understand how I stopped up here, however
    I assumed this publish was good. I do not realize who you are
    however certainly you are going to a famous blogger should you
    aren’t already. Cheers!

  23. Hello, i think that i noticed you visited my weblog so i came to return the favor?.I am attempting to in finding issues
    to improve my site!I assume its adequate to make use of some of your
    ideas!!

Comments are closed.