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. I enjoy what you guys are usually up too. Such clever work and coverage!
    Keep up the awesome works guys I’ve included you guys to blogroll.

  2. It’s a shame you don’t have a donate button! I’d without
    a doubt donate to this brilliant blog! I guess for now i’ll settle for bookmarking and adding
    your RSS feed to my Google account. I look forward to brand
    new updates and will talk about this blog with my Facebook group.
    Talk soon!

  3. Pretty component of content. I simply stumbled upon your weblog
    and in accession capital to say that I acquire actually loved account your blog posts.
    Any way I’ll be subscribing in your augment and even I fulfillment you get admission to constantly rapidly.

  4. Hello! I’m at work browsing your blog from my new
    iphone 3gs! Just wanted to say I love reading through
    your blog and look forward to all your posts! Keep up the fantastic
    work!

  5. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point.
    You obviously know what youre talking about, why waste your intelligence on just posting videos to your site when you could be giving us something enlightening to read?

  6. First off I would like to say terrific blog! I had a quick question that
    I’d like to ask if you do not mind. I was interested to find out how you center
    yourself and clear your thoughts prior to writing.
    I’ve had a difficult time clearing my mind in getting my thoughts
    out there. I do take pleasure in writing but it just
    seems like the first 10 to 15 minutes are usually lost simply just trying to figure out how to begin. Any recommendations or hints?
    Cheers!

  7. Hi my loved one! I want to say that this article is amazing, great written and
    include almost all important infos. I’d like to see more posts like this
    .

  8. Hi there would you mind letting me know which web host you’re using?
    I’ve loaded your blog in 3 completely different browsers and I must say this blog loads a lot quicker then most.
    Can you suggest a good internet hosting provider at a honest price?
    Cheers, I appreciate it!

  9. Hiya very nice blog!! Man .. Excellent .. Wonderful ..
    I will bookmark your blog and take the feeds also?
    I’m satisfied to seek out a lot of helpful information here in the put up, we want
    develop extra strategies in this regard, thank you for sharing.

    . . . . .

  10. When someone writes an article he/she maintains
    the idea of a user in his/her brain that how
    a user can be aware of it. Thus that’s why this paragraph is
    great. Thanks!

  11. Howdy this is kinda 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 knowledge so I wanted
    to get guidance from someone with experience. Any help would be enormously appreciated!

  12. Thank you, I have recently been looking for information about this subject
    for a long time and yours is the greatest I’ve came upon so far.
    However, what concerning the bottom line?

    Are you sure concerning the supply?

  13. Today, I went to the beachfront with my children. 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 put 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!

  14. I’ve been surfing online more than three hours as of late, yet I never discovered any attention-grabbing
    article like yours. It is lovely worth enough for me.
    In my opinion, if all web owners and bloggers made excellent content material
    as you probably did, the internet can be much more useful than ever before.

  15. Hello there! I could have sworn I’ve been to this web site before but after going
    through some of the posts I realized it’s new to me.

    Nonetheless, I’m definitely delighted I found it and I’ll be book-marking it and checking back
    frequently!

  16. Howdy just wanted to give you a quick heads up. The words in your content seem
    to be running off the screen in Opera. 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 layout look great though! Hope you get the problem resolved soon. Cheers

  17. Hi mates, how is all, and what you desire to say about
    this piece of writing, in my view its truly amazing designed for me.

  18. Have you ever thought about including a little bit more
    than just your articles? I mean, what you say is important and all.
    But think about if you added some great photos or videos to give your posts more, “pop”!
    Your content is excellent but with images and videos, this site could definitely be one of
    the most beneficial in its niche. Good blog!

  19. Hey I am so delighted I found your blog page, I really found you by error,
    while I was looking on Google for something else, Nonetheless I am
    here now and would just like to say kudos for a remarkable post and a all
    round entertaining blog (I also love the theme/design), I don’t have time to go through it all at
    the moment but I have book-marked it and also included your RSS feeds,
    so when I have time I will be back to read a great deal more,
    Please do keep up the great work.

  20. Hi there! Quick question that’s completely off topic.

    Do you know how to make your site mobile friendly?
    My weblog looks weird when viewing from my iphone4. I’m trying to find a template or plugin that might be able to correct this
    issue. If you have any recommendations, please share. Appreciate it!

  21. This is very interesting, You’re a very skilled
    blogger. I’ve joined your rss feed and look forward to seeking more of your wonderful post.
    Also, I’ve shared your web site in my social networks!

  22. Thanks on your marvelous posting! I certainly enjoyed reading it, you can be a great author.I will make certain to bookmark your blog and
    may come back later on. I want to encourage you continue your great work,
    have a nice holiday weekend!

  23. Undeniably believe that which you stated. Your favourite justification appeared to be at the internet
    the easiest thing to take note of. I say to you, I definitely get
    irked at the same time as other people consider concerns that they plainly don’t understand about.
    You managed to hit the nail upon the highest as neatly as defined out the entire
    thing without having side effect , other folks could take a signal.
    Will likely be again to get more. Thanks

  24. Magnificent goods from you, man. I’ve understand your stuff
    previous to and you are just too great. I actually like what you’ve
    acquired here, certainly like what you are saying and the way in which
    you say it. You make it entertaining and you still take
    care of to keep it wise. I cant wait to read far more from you.
    This is really a tremendous website.

  25. Appreciating the time and effort you put into your website and in depth
    information you present. It’s nice to come across a blog every once in a while that isn’t the same out of date rehashed
    information. Wonderful read! I’ve bookmarked your site and I’m
    including your RSS feeds to my Google account.

  26. Today, I went to the beachfront 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!

  27. I’m really enjoying the design and layout of your blog.
    It’s a very easy on the eyes which makes it much more
    enjoyable for me to come here and visit more often. Did you hire out a developer
    to create your theme? Great work!

  28. Hey! I know this is kinda off topic but I’d figured I’d ask.
    Would you be interested in trading links or
    maybe guest authoring 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’re
    interested feel free to shoot me an e-mail. I look forward to hearing
    from you! Wonderful blog by the way!

  29. When someone writes an piece of writing he/she retains the idea of a user in his/her brain that how a user can understand it.
    So that’s why this article is great. Thanks!

Comments are closed.