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.

16,631 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. I have been exploring for a little bit for any high quality
    articles or blog posts in this sort of space .
    Exploring in Yahoo I finally stumbled upon this web site.
    Reading this information So i am glad to convey
    that I have a very good uncanny feeling I discovered exactly what I needed.
    I most certainly will make certain to do not fail to remember
    this web site and give it a glance regularly.

  2. Having read this I believed it was rather informative.
    I appreciate you taking the time and energy to put this article together.

    I once again find myself spending a lot of time both reading
    and leaving comments. But so what, it was
    still worth it!

  3. Aw, this was an incredibly good post. Finding the time
    and actual effort to create a good article… but what can I say… I procrastinate a whole lot and never
    manage to get nearly anything done.

  4. Hi, this weekend is good in favor of me, as this occasion i
    am reading this great informative post here at my house.

  5. I’m curious to find out what blog platform
    you have been using? I’m having some small security problems with my latest blog and I’d like to find something more secure.
    Do you have any solutions?

  6. I think the admin of this site is in fact working hard in favor of his web page, for
    the reason that here every information is quality based stuff.

  7. What’s Taking place i’m new to this, I stumbled upon this I’ve discovered
    It positively helpful and it has aided me out loads.
    I am hoping to give a contribution & assist other users like its helped me.
    Good job.

  8. Wonderful blog! Do you have any tips and hints for
    aspiring writers? I’m hoping to start my own site soon but I’m a little lost on everything.
    Would you suggest starting with a free platform like WordPress or go for a paid
    option? There are so many choices out there that I’m totally overwhelmed ..
    Any recommendations? Kudos!

  9. What’s up to every body, it’s my first visit
    of this webpage; this webpage consists of remarkable and truly good material
    in favor of visitors.

  10. whoah this weblog is magnificent i like studying your posts.
    Stay up the great work! You understand, many individuals are searching around for this
    info, you can help them greatly.

  11. I take pleasure in, cause I discovered exactly what I
    was taking a look for. You’ve ended my four day long hunt!

    God Bless you man. Have a great day. Bye

  12. very interesting review. In addition visit all of our site to learn slot pulsa.
    Excellent internet site has received personality from the video slot gambling establishment participants in Dalam
    negeri. Right now there are actually quite a few fascinating
    promos when you join at this time.

  13. Good day! I could have sworn I’ve been to this site before but after browsing through many of
    the articles I realized it’s new to me. Anyways, I’m definitely delighted
    I found it and I’ll be bookmarking it and checking back often!

Comments are closed.