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. First of all I want to say terrific blog!
    I had a quick question which I’d like to ask if
    you don’t mind. I was curious to know how you center yourself and clear
    your head before writing. I have had difficulty clearing my mind in getting my thoughts out
    there. I truly do take pleasure in writing but it just seems like the
    first 10 to 15 minutes are wasted just trying to figure out how to begin.
    Any recommendations or hints? Appreciate it!

  2. Have you ever thought about creating an ebook or guest
    authoring on other websites? I have a blog based on the same topics you discuss and
    would really like to have you share some stories/information. I know my visitors
    would value your work. If you’re even remotely interested, feel free to shoot me an e-mail.

  3. I am really enjoying the theme/design of your weblog.
    Do you ever run into any browser compatibility problems?

    A small number of my blog readers have complained about my blog not operating correctly in Explorer but looks great in Safari.

    Do you have any tips to help fix this problem?

  4. I know this if off topic but I’m looking into starting my own weblog 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 internet smart so I’m not 100% certain. Any recommendations or advice would be greatly appreciated.
    Thanks

  5. You are so interesting! I do not suppose I have read something
    like that before. So nice to find another person with some genuine thoughts
    on this topic. Really.. thanks for starting this up.
    This web site is something that is required on the web, someone with a little originality!

  6. Greetings from Ohio! I’m bored to death at work so I decided
    to browse your site on my iphone during lunch break. I enjoy the information you provide here and
    can’t wait to take a look when I get home. I’m shocked
    at how fast your blog loaded on my mobile ..
    I’m not even using WIFI, just 3G .. Anyways, good blog!

  7. Link exchange is nothing else however it is simply placing the other person’s website link on your
    page at appropriate place and other person will also do
    similar in support of you.

  8. I believe everything wrote was actually very logical.
    But, what about this? suppose you added a little information? I mean, I don’t want to tell you how to run your website, but suppose
    you added a headline that grabbed people’s attention? I mean Contoh Soal Pemrograman – Pola Segitiga Siku-siku –
    Umar faisol is a little vanilla. You ought to peek at Yahoo’s front page and watch how they create news
    headlines to grab people interested. You might add a related video
    or a pic or two to grab readers interested about everything’ve got to say.
    In my opinion, it would make your posts a little livelier.

  9. It’s nearly impossible to find knowledgeable people
    for this subject, however, you seem like you know what you’re talking about!
    Thanks

  10. You could certainly see your skills in the article you write.
    The sector hopes for even more passionate writers like you who are not afraid to say how they believe.
    At all times go after your heart.

  11. I love your blog.. very nice colors & theme.
    Did you design this website yourself or did you hire someone to do it for you?
    Plz respond as I’m looking to create my own blog and would like to find out where u got
    this from. cheers

  12. I think this is one of the most important information for me.
    And i’m glad reading your article. But want to remark on some general things,
    The web site style is wonderful, the articles is really great : D.

    Good job, cheers

  13. Wow, incredible weblog structure! How lengthy have you
    ever been running a blog for? you made blogging glance
    easy. The whole glance of your website is fantastic,
    as well as the content material!

  14. My developer is trying to convince me to move to .net from PHP.
    I have always disliked the idea because of the costs.
    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 good things about blogengine.net. Is there a
    way I can import all my wordpress content into it? Any
    kind of help would be really appreciated!

  15. 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 several e-mails with the same comment.
    Is there any way you can remove me from that service?
    Thanks a lot!

  16. I am extremely impressed with your writing talents as smartly as with the layout to your weblog.
    Is that this a paid topic or did you customize it yourself?

    Anyway keep up the excellent high quality writing, it is uncommon to see a
    nice weblog like this one these days..

  17. Usually I do not read post on blogs, however I wish to
    say that this write-up very pressured me to take a look at and do so!

    Your writing taste has been surprised me. Thanks, very nice post.

  18. It’s perfect time to make some plans for the long run and it’s time to be happy.
    I’ve read this put up and if I may just I want to suggest
    you some interesting things or tips. Maybe you could
    write subsequent articles referring to this article.

    I wish to learn more things approximately it!

  19. You really make it seem so easy with your presentation but
    I find this matter to be actually something that I think I would never understand.
    It seems too complex and very broad for me. I am looking forward for your next post, I’ll try to get the
    hang of it!

  20. Hi would you mind sharing which blog platform you’re using?
    I’m going to start my own blog soon but I’m having a hard time making a
    decision between BlogEngine/Wordpress/B2evolution and Drupal.

    The reason I ask is because your design and style
    seems different then most blogs and I’m looking for something unique.
    P.S Sorry for being off-topic but I had to ask!

Comments are closed.