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,215 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. Simply desire to say your article is as astonishing.
    The clarity for your put up is simply cool and that i could assume you’re
    knowledgeable in this subject. Well together with your permission allow me to take
    hold of your feed to keep updated with drawing close post.
    Thank you one million and please carry on the enjoyable
    work.

  2. You actually make it seem really easy together with your presentation but
    I to find this matter to be actually one thing that I feel I’d by no means understand.
    It sort of feels too complex and very large for me.
    I’m taking a look ahead for your subsequent put up, I’ll attempt
    to get the dangle of it!

  3. Hello there, just became aware of your blog through Google,
    and found that it’s really informative. I’m gonna watch out for brussels.
    I’ll be grateful if you continue this {in future}.
    Numerous people will be benefited from your writing. Cheers!

  4. Hey there, You’ve done an incredible job. I’ll definitely digg it and personally recommend to
    my friends. I’m sure they will be benefited from this website.

  5. I absolutely love your blog and find nearly all of your post’s to be exactly what I’m looking for.

    Do you offer guest writers to write content available for you?
    I wouldn’t mind composing a post or elaborating on most of the subjects you write with regards to here.
    Again, awesome weblog!

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

  7. Hello there! This article couldn’t be written any better!
    Going through this post reminds me of my previous roommate!
    He continually kept talking about this. I am going to forward this post to him.
    Fairly certain he’ll have a very good read. I appreciate you for
    sharing!

  8. Excellent blog here! Also your web site quite a bit up
    very fast! What web host are you the use of? Can I am
    getting your affiliate hyperlink in your host?
    I wish my website loaded up as fast as yours lol

  9. It’s not my first time to go to see this web
    page, i am browsing this web page dailly and obtain good facts
    from here daily.

  10. What i do not understood is in reality how you are now not
    actually a lot more well-appreciated than you may be now.
    You are so intelligent. You recognize thus significantly
    on the subject of this topic, produced me individually consider
    it from numerous varied angles. Its like women and men are not interested until it is one thing to accomplish with Woman gaga!
    Your individual stuffs great. At all times care for it
    up!

  11. Fantastic goods from you, man. I have understand
    your stuff previous to and you’re just extremely magnificent.
    I really like what you’ve acquired here, certainly like
    what you’re stating and the way in which you say it.
    You make it enjoyable and you still care for to keep it wise.
    I cant wait to read much more from you. This is actually a tremendous site.

  12. Hey! Someone in my Myspace group shared this website with us so I came to give it a look.
    I’m definitely enjoying the information. I’m book-marking and will be tweeting
    this to my followers! Exceptional blog and excellent design and
    style.

  13. Hello just wanted to give you a quick heads up.
    The text 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 web browser compatibility but I thought I’d post to let
    you know. The style and design look great though! Hope you get the problem
    solved soon. Many thanks

  14. An impressive share! I’ve just forwarded this onto a friend who has been doing a
    little homework on this. And he actually ordered me dinner simply because I discovered it for him…
    lol. So let me reword this…. Thanks for the
    meal!! But yeah, thanks for spending some time to discuss this matter here
    on your site.

  15. When I initially left a comment I appear to have clicked on the -Notify
    me when new comments are added- checkbox and from now on every time a comment is added I recieve 4
    emails with the same comment. There has to be a way you can remove me from
    that service? Thanks!

  16. Fantastic blog! Do you have any suggestions for aspiring writers?
    I’m hoping to start my own site soon but I’m a little lost on everything.
    Would you propose starting with a free platform like WordPress or go for a paid option? There are so many options out there that I’m totally confused
    .. Any suggestions? Bless you!

  17. Hey are using WordPress for your blog platform?
    I’m new to the blog world but I’m trying to get started and set up my own. Do
    you require any coding expertise to make your own blog?
    Any help would be really appreciated!

  18. Undeniably consider that which you said. Your favourite reason appeared
    to be on the net the easiest factor to take into
    accout of. I say to you, I definitely get irked while folks
    consider concerns that they plainly don’t recognise about.
    You controlled to hit the nail upon the top and defined out the whole thing with no need
    side-effects , folks can take a signal. Will likely be again to get more.

    Thank you

  19. Great post. I used to be checking continuously this blog and I am impressed!
    Very helpful info particularly the remaining
    section 🙂 I deal with such information a lot. I used to be looking for this particular information for a very lengthy time.

    Thank you and best of luck.

  20. Wonderful beat ! I would like to apprentice while you amend your site, how can i subscribe for a blog web site?
    The account helped me a acceptable deal. I had been a little bit acquainted of this your broadcast provided bright clear
    concept

  21. It’s appropriate time to make a few plans for the future and it’s time to be
    happy. I have read this post and if I could I want to counsel you few attention-grabbing
    things or advice. Perhaps you could write next articles
    referring to this article. I want to read even more things approximately it!

  22. Nice post. I was checking constantly this weblog and I’m inspired!
    Very useful info particularly the ultimate section 🙂 I take care of
    such info a lot. I used to be looking for this certain info for a long
    time. Thanks and good luck.

  23. Good day! I just would like to offer you a huge thumbs up
    for your excellent information you’ve got here on this post.
    I’ll be returning to your website for more soon.

  24. of course like your web site however you need to take a look at the
    spelling on quite a few of your posts. Many of them are
    rife with spelling problems and I to find it very
    bothersome to tell the truth nevertheless I will definitely come back again.

  25. I do believe all the ideas you’ve offered to your post.
    They’re very convincing and will certainly work.
    Nonetheless, the posts are very brief for starters.
    May just you please extend them a bit from subsequent time?
    Thanks for the post.

  26. Hi there just wanted to give you a quick heads up
    and let you know a few of the pictures aren’t loading correctly.

    I’m not sure why but I think its a linking issue. I’ve tried it in two different internet browsers and both show the same results.

  27. I like the helpful information you provide in your articles.
    I’ll bookmark your blog and check again here frequently.
    I’m quite sure I will learn many new stuff right here!
    Best of luck for the next!

Comments are closed.