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. Greetings from Ohio! I’m bored to death at work so I decided
    to browse your website on my iphone during lunch break.

    I really like the knowledge you present here and can’t wait to take a look when I get home.
    I’m shocked at how fast your blog loaded on my
    cell phone .. I’m not even using WIFI, just 3G ..
    Anyhow, wonderful site!

  2. Hi there! Quick question that’s totally off topic.
    Do you know how to make your site mobile friendly?
    My site looks weird when viewing from my iphone. I’m trying to find
    a theme or plugin that might be able to resolve this problem.
    If you have any suggestions, please share. Many thanks!

  3. Thanks , I’ve recently been searching for information approximately this subject for ages and yours is the best I’ve discovered so far.
    But, what concerning the conclusion? Are you positive in regards to the source?

  4. Whats up this is somewhat of off topic but I was wondering if blogs
    use WYSIWYG editors or if you have to manually code with HTML.
    I’m starting a blog soon but have no coding experience so I wanted
    to get advice from someone with experience. Any help would be greatly appreciated!

  5. Thanks for a marvelous posting! I certainly enjoyed reading it,
    you are a great author.I will remember to bookmark your blog and will eventually come back later in life.
    I want to encourage you to continue your great job, have a nice
    afternoon!

  6. Hi, i think that i saw you visited my blog so i came to “return the favor”.I’m attempting
    to find things to enhance my site!I suppose its ok to
    use a few of your ideas!!

  7. Hey, I think your website might be having browser compatibility issues.

    When I look at your blog in Safari, 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, superb blog!

  8. I know this if off topic but I’m looking into
    starting my own blog and was wondering what all is required to get
    setup? I’m assuming having a blog like yours would cost a pretty penny?
    I’m not very web smart so I’m not 100% positive. Any suggestions or advice would be greatly appreciated.
    Kudos

  9. Wonderful work! This is the type of info that should be shared around the web.

    Shame on the search engines for no longer positioning this post
    higher! Come on over and seek advice from my site .
    Thank you =)

  10. Howdy I am so thrilled I found your webpage, I really found
    you by mistake, while I was researching on Aol for
    something else, Nonetheless I am here now and would just like to say many thanks
    for a marvelous post and a all round enjoyable blog (I also love the theme/design), I
    don’t have time to browse it all at the minute but I have saved
    it and also added in your RSS feeds, so when I have time
    I will be back to read more, Please do keep up the great work.

  11. We’re a group of volunteers and opening a new scheme in our community.
    Your web site provided us with valuable info to work on. You’ve done a formidable process and our entire community will probably be thankful to you.

  12. After looking at a handful of the blog posts on your site, I truly like your way of blogging.
    I bookmarked it to my bookmark site list and will be checking back
    in the near future. Take a look at my website as well and tell me what you
    think.

  13. When someone writes an paragraph he/she keeps the plan of a user in his/her brain that how a user can be aware of it.

    Thus that’s why this post is perfect. Thanks!

  14. Does your website have a contact page? I’m having a tough time locating
    it but, I’d like to send you an email. I’ve got some recommendations for
    your blog you might be interested in hearing. Either way, great site and I look forward to seeing it improve over time.

  15. I’m really impressed along with your writing
    skills and also with the structure in your weblog. Is this
    a paid topic or did you customize it your self? Anyway stay up
    the excellent quality writing, it is uncommon to peer
    a great blog like this one today..

  16. I’m not sure where you are getting your information, but great topic.
    I needs to spend some time learning much more or understanding more.
    Thanks for magnificent info I was looking for this info for my mission.

  17. I have been surfing online more than 2 hours today, yet I never found any interesting article like yours.
    It’s pretty worth enough for me. In my opinion, if all web owners and bloggers made good content as you did,
    the net will be a lot more useful than ever before.

  18. Thanks for your personal marvelous posting!
    I truly enjoyed reading it, you may be a great author.I will ensure that
    I bookmark your blog and will eventually come back sometime soon. I want to encourage you to
    continue your great writing, have a nice weekend!

  19. Attractive section of content. I just stumbled upon your blog and in accession capital to assert
    that I get actually enjoyed account your blog posts.
    Any way I will be subscribing to your feeds and even I achievement
    you access consistently quickly.

  20. Please let me know if you’re looking for
    a article writer for your weblog. You have some really great articles and I feel I would be a good asset.
    If you ever want to take some of the load off, I’d absolutely love to write some articles for your blog in exchange for a link back
    to mine. Please send me an e-mail if interested.
    Thanks!

  21. I am not positive the place you are getting your information, however good topic.
    I needs to spend some time studying much more or figuring out more.
    Thank you for great info I used to be on the lookout for this info for my
    mission.

  22. Spot on with this write-up, I honestly believe this web site needs
    a great deal more attention. I’ll probably be back again to read through more, thanks
    for the advice!

  23. I simply couldn’t leave your web site prior to suggesting that
    I really enjoyed the standard information a person provide for your visitors?
    Is gonna be back regularly in order to investigate cross-check new posts

  24. Helpful info. Fortunate me I found your website by accident, and
    I’m shocked why this coincidence did not took place in advance!
    I bookmarked it.

  25. Hi, i read your blog occasionally and i own a similar one and i was just curious if
    you get a lot of spam remarks? If so how do you stop it,
    any plugin or anything you can advise? I get so much lately it’s driving me mad so any
    assistance is very much appreciated.

  26. obviously like your web-site but you have to take a look at the spelling on several
    of your posts. A number of them are rife with spelling problems and I in finding it very troublesome
    to inform the truth however I will definitely come again again.

  27. Hi are using WordPress for your site platform? I’m new to the blog world
    but I’m trying to get started and create my own. Do you require any html coding
    expertise to make your own blog? Any help would be greatly appreciated!

Comments are closed.