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. 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!

  2. Heya! I understand this is kind of off-topic but I had to ask.
    Does operating a well-established blog such as yours take a massive amount work?
    I’m completely new to running a blog however I do write
    in my journal everyday. I’d like to start a blog so I can share my personal experience and views online.

    Please let me know if you have any recommendations or tips for new
    aspiring blog owners. Appreciate it!

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

  4. 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?

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

  6. 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.

  7. 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!

  8. 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!

  9. Hello, this weekend is nice designed for me, since this moment
    i am reading this wonderful informative paragraph here at my residence.

  10. At this time it seems like BlogEngine is the best blogging platform available right now.
    (from what I’ve read) Is that what you are using on your blog?

  11. Hello friends, how is the whole thing, and what you desire to say concerning this post, in my view its in fact amazing in support
    of me.

  12. Ahaa, its nice conversation concerning this paragraph at this place at this web site,
    I have read all that, so at this time me also commenting at
    this place.

  13. Excellent blog here! Also your web site loads up very fast!
    What web host are you using? Can I get your associate link to your host?
    I desire my web site loaded up as quickly as yours lol

  14. I read this post fully about the comparison of most recent and previous technologies, it’s amazing
    article.

  15. You can certainly see your enthusiasm in the work you write.
    The arena hopes for more passionate writers such as
    you who aren’t afraid to say how they believe.
    All the time follow your heart.

  16. Its like you learn my thoughts! You appear to know a lot approximately this, like you wrote the
    e-book in it or something. I feel that you simply can do with some
    percent to power the message home a bit, but other than that, that is wonderful
    blog. An excellent read. I’ll definitely be back.

  17. Amazing blog! Do you have any suggestions for aspiring writers?
    I’m planning to start my own site soon but I’m a little lost on everything.
    Would you recommend 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? Appreciate it!

  18. Hi my loved one! I wish to say that this article is amazing, nice written and come with approximately all significant
    infos. I’d like to look extra posts like this .

  19. I have read so many articles or reviews concerning the blogger lovers
    however this piece of writing is actually a good post, keep it up.

  20. It’s appropriate time to make some plans for the longer term and it is time
    to be happy. I’ve read this publish and if I may I
    desire to counsel you few fascinating things or tips.

    Maybe you could write subsequent articles relating to this
    article. I wish to learn even more things approximately it!

Comments are closed.