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

  1. You made some good points there. I looked on the web to learn more about the issue and found most people will go along with
    your views on this site.

  2. Hi there, I found your web site by means of Google while looking for a similar matter, your website came
    up, it seems to be good. I’ve bookmarked it in my google bookmarks.

    Hi there, just turned into aware of your weblog via Google, and located that it is truly informative.
    I’m going to be careful for brussels. I will be grateful in case you proceed this in future.
    A lot of folks might be benefited from your writing. Cheers!

  3. For the reason that the admin of this website is working, no doubt very soon it will be renowned, due
    to its feature contents.

  4. Thank you for another informative site. The place
    else may just I am getting that type of information written in such
    a perfect method? I’ve a undertaking that I’m simply now running on, and I’ve been on the look out for such information.

  5. I’m gone to say to my little brother, that he should also
    visit this web site on regular basis to get updated from most up-to-date gossip.

  6. I’m not that much of a internet reader to be honest
    but your sites really nice, keep it up! I’ll go ahead and bookmark your website to come back down the road.
    All the best

  7. I’m impressed, I must say. Rarely do I encounter a blog that’s both educative and engaging, and let me tell you, you have hit the
    nail on the head. The problem is an issue that too few men and women are speaking intelligently about.
    I’m very happy I came across this during my hunt for something relating to this.

  8. Woah! I’m really enjoying the template/theme of this blog.
    It’s simple, yet effective. A lot of times it’s hard to get that “perfect balance” between usability and appearance.
    I must say that you’ve done a very good job with this.
    Additionally, the blog loads very quick for me on Safari.
    Superb Blog!

  9. I’m very happy to uncover this great site. I wanted to thank you for
    your time for this wonderful read!! I definitely enjoyed every part of it and I have you bookmarked to look at new stuff on your website.

  10. 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 need any html coding expertise to make your own blog?
    Any help would be greatly appreciated!

  11. Hi there! I’m at work surfing around your blog from my new iphone
    4! Just wanted to say I love reading through your
    blog and look forward to all your posts! Keep
    up the great work!

  12. Hello, i think that i saw you visited my weblog so i came
    to “return the favor”.I am attempting to find things to improve
    my web site!I suppose its ok to use some of your ideas!!

  13. I’m truly 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 designer to create your theme?
    Superb work!

  14. What’s up everyone, it’s my first pay a quick visit at this web page, and paragraph is genuinely fruitful designed for
    me, keep up posting these articles.

  15. Today, while I was at work, my sister stole my apple ipad and tested to see
    if it can survive a forty foot drop, just so she can be a
    youtube sensation. My apple ipad is now broken and she has 83 views.

    I know this is totally off topic but I had to share it with someone!

    Feel free to surf to my website – acne skin

  16. I must thank you for the efforts you have put in writing this site.
    I am hoping to check out the same high-grade blog
    posts by you later on as well. In fact, your creative writing abilities has encouraged me to get
    my own website now 😉

  17. Wonderful goods from you, man. I have understand your stuff previous to and
    you are just extremely fantastic. I actually like what you have acquired
    here, really like what you are saying and the
    way in which you say it. You make it entertaining and you still
    care for to keep it wise. I can not wait to read far more from
    you. This is really a terrific web site.

  18. I do not even know how I ended up here, but I
    thought this post was good. I do not know who you are but definitely you’re going to a famous blogger if you aren’t already ;
    ) Cheers!

  19. I know this site provides quality depending posts and extra data, is there
    any other web site which provides such things in quality?

    Feel free to surf to my web site: weed doctor

  20. It’s remarkable to pay a visit this web site and reading the views of all mates on the topic of this piece of writing, while I am also eager of
    getting familiarity.

  21. Hello! I know this is somewhat off-topic but I needed to ask.
    Does building a well-established website like yours require a large amount of work?

    I am completely new to operating a blog but I do write in my journal everyday.
    I’d like to start a blog so I can share my personal experience and
    feelings online. Please let me know if you have any suggestions or
    tips for new aspiring bloggers. Appreciate it!

Comments are closed.