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 was wondering if you ever thought of changing the structure of your blog?
    Its very well written; I love what youve got
    to say. But maybe you could a little more in the way of content so people could
    connect with it better. Youve got an awful lot of text for only having one or two images.
    Maybe you could space it out better?

  2. Hello, this weekend is pleasant designed for me, for the
    reason that this moment i am reading this great educational post here
    at my residence.

  3. I think everything said was actually very reasonable.
    But, what about this? what if you were to write a killer headline?
    I am not suggesting your content is not good, but what if you added a post title that
    makes people want more? I mean Contoh Soal Pemrograman – Pola Segitiga Siku-siku –
    Umar faisol is kinda plain. You ought to look at Yahoo’s
    home page and see how they write article titles to get viewers to
    open the links. You might add a related video or a pic or two to grab readers excited about
    everything’ve written. Just my opinion, it might make your posts
    a little livelier.

  4. I have been exploring for a little for any high quality articles or blog posts in this kind
    of house . Exploring in Yahoo I finally stumbled upon this web site.
    Reading this information So i am satisfied to convey that
    I’ve an incredibly good uncanny feeling I discovered exactly what I needed.
    I so much indisputably will make certain to don?t put out of your mind this web site and
    provides it a look regularly.

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

  6. I don’t even know the way I finished up here, however I thought
    this put up was once great. I don’t understand who you might be but certainly you are going to a famous blogger if you happen to aren’t
    already. Cheers!

  7. What’s up, this weekend is pleasant in favor of me, because this moment i am reading this wonderful informative piece of writing here at my
    home.

  8. Hello! Someone in my Facebook group shared this site with us
    so I came to take a look. I’m definitely enjoying the information. I’m
    bookmarking and will be tweeting this to my
    followers! Exceptional blog and superb design.

  9. Why viewers still use to read news papers when in this
    technological world the whole thing is available on web?

  10. Hi there! I just wanted to ask if you ever have any
    trouble with hackers? My last blog (wordpress) was hacked and I ended up losing many months of hard work due to no back up.

    Do you have any methods to prevent hackers?

  11. Hey! This is my first visit to your blog!
    We are a group of volunteers and starting a new project in a community in the same niche.
    Your blog provided us useful information to work on. You have done a outstanding job!

  12. I just like the helpful information you provide for your articles.
    I’ll bookmark your blog and take a look at once more here regularly.

    I’m quite certain I will be told lots of new stuff proper right here!

    Best of luck for the next!

  13. I do not even know the way I ended up here, however I thought
    this submit was once great. I do not recognize who you
    are however certainly you are going to a famous blogger if you aren’t already.
    Cheers!

  14. Hi there everyone, it’s my first visit at this
    site, and post is in fact fruitful for me, keep up posting such articles.

  15. excellent issues altogether, you just gained a brand new reader.
    What might you recommend about your post that you
    just made some days in the past? Any sure?

  16. Asking questions are in fact pleasant thing if you are not understanding something fully, however this piece of writing
    presents good understanding even.

  17. Attractive portion of content. I simply stumbled upon your web site and in accession capital to assert
    that I get actually enjoyed account your weblog posts.
    Any way I will be subscribing in your augment or even I achievement you get right of
    entry to consistently quickly.

  18. When I initially commented I clicked the “Notify me when new comments are added”
    checkbox and now each time a comment is added I get several e-mails
    with the same comment. Is there any way you can remove people
    from that service? Appreciate it!

  19. Today, I went to the beach 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 completely
    off topic but I had to tell someone!

Comments are closed.