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. Woah! I’m really digging the template/theme of this blog.
    It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between user friendliness and visual appearance.

    I must say that you’ve done a great job with this.
    In addition, the blog loads extremely fast for me on Internet explorer.
    Superb Blog!

  2. Hey there! I know this is kinda off topic but I was wondering
    if you knew where I could locate a captcha plugin for my comment form?
    I’m using the same blog platform as yours and I’m having difficulty
    finding one? Thanks a lot!

  3. My coder is trying to convince me to move to .net from PHP.

    I have always disliked the idea because of the expenses.
    But he’s tryiong none the less. I’ve been using Movable-type on various websites for about a
    year and am anxious about switching to another
    platform. I have heard excellent things about blogengine.net.
    Is there a way I can transfer all my wordpress content into it?
    Any kind of help would be really appreciated!

  4. This is the right webpage for anybody who wishes to find out about this
    topic. You know a whole lot its almost hard to argue with you (not that I actually would want to…HaHa).
    You definitely put a new spin on a subject which has been written about for
    a long time. Great stuff, just wonderful!

  5. It is actually a nice and helpful piece of info. I’m satisfied
    that you just shared this helpful info with us.
    Please keep us up to date like this. Thank you
    for sharing.

  6. I do not even know how I stopped up here, but I thought
    this post used to be great. I don’t realize who you’re but definitely
    you are going to a well-known blogger for those who aren’t already.
    Cheers!

  7. Excellent site you have here but I was wondering if you knew of any forums that cover the same topics talked about here?
    I’d really like to be a part of community where I
    can get feed-back from other experienced people that share the same interest.
    If you have any suggestions, please let me know. Thank you!

  8. Appreciating the persistence you put into your blog and in depth information you present.
    It’s awesome to come across a blog every once in a while that isn’t the same old rehashed material.

    Wonderful read! I’ve saved your site and I’m including your RSS feeds to my
    Google account.

  9. Hello there! This is my first visit to your blog! We are a group of volunteers and starting a new project in a community in the same niche.
    Your blog provided us useful information to work on. You have
    done a extraordinary job!

  10. Hey there 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 need any html coding expertise to make your own blog?

    Any help would be greatly appreciated!

  11. Hi there just wanted to give you a quick heads up. The text in your
    content seem to be running off the screen in Ie. I’m not sure if this is a format issue or something to do with browser compatibility but I figured I’d post to let you know.
    The design and style look great though! Hope
    you get the problem solved soon. Kudos

  12. My developer is trying to persuade me to move to .net from PHP.
    I have always disliked the idea because of
    the expenses. But he’s tryiong none the less. I’ve been using WordPress
    on several websites for about a year and am nervous about switching to another platform.
    I have heard great things about blogengine.net.
    Is there a way I can transfer all my wordpress posts into it?
    Any kind of help would be greatly appreciated!

  13. Wonderful site you have here but I was wanting to know if you knew of any
    user discussion forums that cover the same topics discussed in this article?
    I’d really like to be a part of group where I can get suggestions from other knowledgeable individuals that share the same interest.
    If you have any suggestions, please let me know.
    Appreciate it!

  14. I have been exploring for a little for any high quality articles
    or blog posts in this kind of space . Exploring in Yahoo I at last
    stumbled upon this website. Reading this info So i am happy to
    exhibit that I have an incredibly good uncanny
    feeling I came upon just what I needed. I such a lot indubitably will make sure
    to do not overlook this website and provides it a glance regularly.

  15. Hey there! This is my first visit to your blog! We are a
    team of volunteers and starting a new project in a community in the same niche.
    Your blog provided us useful information to work on. You have done a extraordinary job!

  16. I would like to thank you for the efforts you’ve put in penning this website.
    I’m hoping to check out the same high-grade content by
    you in the future as well. In truth, your
    creative writing abilities has motivated me to get my very own website now 😉

  17. We absolutely love your blog and find almost all of your post’s to be exactly what I’m looking for.
    Would you offer guest writers to write content available for you?
    I wouldn’t mind composing a post or elaborating on a lot of the subjects you write with regards to here.
    Again, awesome blog!

  18. Nice post. I was checking constantly this weblog
    and I’m inspired! Extremely helpful information specially the remaining part 🙂 I deal with such information a lot.
    I was looking for this particular info for a long time.
    Thank you and good luck.

  19. This is the perfect webpage for anybody who wants to find out about this topic.

    You know so much its almost hard to argue with you (not that I actually will need to…HaHa).
    You certainly put a new spin on a topic that’s
    been discussed for ages. Great stuff, just wonderful!

  20. constantly i used to read smaller content that also clear their motive,
    and that is also happening with this article which I am reading at this place.

  21. When someone writes an post he/she retains the image
    of a user in his/her brain that how a user can be aware
    of it. Thus that’s why this piece of writing is great.
    Thanks!

  22. Hello my loved one! I wish to say that this post is amazing, nice written and include
    almost all vital infos. I’d like to peer extra posts like this .

  23. Hi! I’m at work surfing around your blog from
    my new iphone! Just wanted to say I love reading through your blog and look forward to all your posts!
    Carry on the outstanding work!

  24. I need to to thank you for this fantastic read!!
    I certainly loved every little bit of it. I have got you book marked to look
    at new things you post…

Comments are closed.