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.

17,247 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. It’s a pity you don’t have a donate button! I’d without a
    doubt donate to this brilliant blog! I suppose for now
    i’ll settle for book-marking and adding your RSS feed to my Google account.
    I look forward to brand new updates and will share this site with my Facebook group.
    Chat soon!

  2. Hi! I know this is kinda off topic but I’d figured I’d ask.
    Would you be interested in exchanging links or maybe guest authoring a blog post or vice-versa?
    My blog addresses a lot of the same topics as yours and I think we could greatly benefit from each other.

    If you are interested feel free to shoot me an email.
    I look forward to hearing from you! Fantastic blog by the way!

  3. Hmm is anyone else encountering problems with the pictures on this blog loading?
    I’m trying to determine if its a problem on my end or if it’s the blog.
    Any feed-back would be greatly appreciated.

  4. I do not even know the way I ended up here, but I thought this put up used to be great.
    I don’t recognise who you might be however definitely you’re going to a famous blogger for those who
    aren’t already. Cheers!

  5. 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 knowledge you present here and can’t wait to take a look when I get home.
    I’m amazed at how fast your blog loaded on my mobile ..
    I’m not even using WIFI, just 3G .. Anyhow, superb blog!

  6. Wow! This blog looks exactly like my old one!
    It’s on a completely different topic but it has pretty much the same layout
    and design. Great choice of colors!

  7. With havin so much written content do you ever run into any problems of plagorism or
    copyright violation? My blog has a lot of unique content I’ve either
    created myself or outsourced but it appears a lot of it is popping it up all over the
    web without my agreement. Do you know any ways to help reduce content from
    being stolen? I’d definitely appreciate it.

  8. Asking questions are in fact fastidious thing if you are not understanding
    something entirely, except this piece of
    writing gives nice understanding even.

  9. This is very interesting, You are a very skilled blogger.
    I have joined your rss feed and look forward to seeking more of your fantastic post.
    Also, I have shared your site in my social networks!

  10. Attractive section of content. I just stumbled upon your site
    and in accession capital to claim that I acquire actually enjoyed account your blog posts.
    Anyway I will be subscribing on your feeds and even I success you get entry to consistently rapidly.

  11. Pretty component to content. I simply stumbled upon your blog and in accession capital
    to assert that I acquire actually enjoyed account your weblog posts.
    Any way I will be subscribing in your augment and even I success
    you get right of entry to consistently quickly.

  12. Currently it appears like Drupal is the preferred blogging platform
    out there right now. (from what I’ve read) Is that what you’re using
    on your blog?

  13. Hmm is anyone else having problems with the images on this blog loading?
    I’m trying to figure out if its a problem on my end
    or if it’s the blog. Any responses would be greatly appreciated.

  14. Pretty element of content. I simply stumbled upon your web site and in accession capital to claim that I get in fact loved account your blog posts.
    Any way I will be subscribing for your feeds and even I
    achievement you get entry to consistently rapidly.

  15. Greetings, I believe your web site may be having internet browser compatibility problems.
    When I look at your web site in Safari, it looks fine however when opening
    in Internet Explorer, it has some overlapping issues.

    I simply wanted to provide you with a quick heads up!
    Apart from that, wonderful blog!

    Take a look at my homepage: daftar poker online

Comments are closed.