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

  1. Way cool! Some extremely valid points! I appreciate you writing this
    article plus the rest of the website is also very
    good.

  2. My spouse and I stumbled over here from a different web page and thought I might as well check things
    out. I like what I see so i am just following you. Look forward to
    finding out about your web page yet again.

  3. Thanks for your marvelous posting! I definitely enjoyed reading it, you might be a great author.
    I will make certain to bookmark your blog and will eventually come
    back in the future. I want to encourage you to ultimately continue your great work, have a nice holiday weekend!

  4. Undeniably believe that which you said. Your favorite reason appeared
    to be on the web the easiest thing to be aware of.
    I say to you, I certainly get irked while people consider worries that they just do not know about.
    You managed to hit the nail upon the top and defined out the whole thing without having side-effects ,
    people could take a signal. Will likely
    be back to get more. Thanks

  5. It’s amazing to pay a visit this website and reading the views of
    all friends regarding this post, while I am also zealous of getting experience.

  6. It is appropriate time to make a few plans for the future and
    it’s time to be happy. I’ve learn this publish and if I may just I desire to suggest you
    some interesting issues or tips. Perhaps you could write subsequent
    articles relating to this article. I want to learn more things approximately
    it!

  7. Hi there, i read your blog from time to time and i
    own a similar one and i was just wondering if you get a lot
    of spam feedback? If so how do you reduce it, any plugin or anything you can recommend?
    I get so much lately it’s driving me insane so
    any assistance is very much appreciated.

  8. Today, 55% of businesses invest in professional search engine optimization (SEO) services. Before your company even considers SEO services, though, it’s critical to answer these two questions: What are SEO services, and what should an SEO company’s services include?

  9. Actually when someone doesn’t know after that its up to other visitors that
    they will help, so here it takes place.

Comments are closed.