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 for … in.

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

  1. With havin so much content do you ever run into any problems of plagorism or copyright infringement?
    My site has a lot of unique content I’ve either authored myself or outsourced but it seems a lot of
    it is popping it up all over the internet without my permission. Do you know any methods to help stop content from being stolen? I’d certainly appreciate it.

  2. Today, I went to the beachfront 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 totally off topic but
    I had to tell someone!

  3. Very nice post. I just stumbled upon your weblog and wished
    to say that I have truly enjoyed browsing your blog
    posts. After all I’ll be subscribing to your feed and I hope you write again very
    soon!

  4. I just like the helpful info you provide on your articles.
    I will bookmark your weblog and check again here regularly.
    I am relatively sure I’ll be informed lots of new
    stuff right here! Good luck for the next!

  5. Link exchange is nothing else but it is simply placing
    the other person’s weblog link on your page at proper place and other person will also do same in favor of you.

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

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

  8. Hello fantastic blog! Does running a blog like this take a lot of work?
    I have absolutely no knowledge of programming however I was hoping to start my own blog
    soon. Anyhow, should you have any suggestions or tips for new blog owners please share.
    I know this is off topic nevertheless I just wanted to ask.
    Cheers!

  9. Hello, i feel that i noticed you visited my weblog thus i got here
    to return the desire?.I’m attempting to find issues to enhance my web site!I assume its good enough to
    make use of a few of your concepts!!

  10. I feel that is one of the most important info for me. And i’m happy studying
    your article. But should observation on some general issues, The site taste is great,
    the articles is truly nice : D. Just right activity,
    cheers

  11. An intriguing discussion is definitely worth comment.
    I do think that you need to publish more
    on this subject matter, it might not be a taboo subject but usually
    people don’t speak about such subjects. To the next! Cheers!!

  12. Hey there, You have done an incredible job. I’ll definitely digg it and personally recommend to my friends.
    I’m confident they’ll be benefited from this site.

  13. Hi, constantly i used to check webpage posts here in the early hours in the daylight,
    for the reason that i enjoy to learn more and more.

  14. Valuable information. Fortunate me I discovered your site unintentionally, and I am surprised why
    this twist of fate did not came about earlier! I bookmarked it.

  15. It’s not my first time to go to see this web page, i am visiting this web page dailly and obtain pleasant
    data from here every day.

  16. you are actually a good webmaster. The site loading speed
    is amazing. It sort of feels that you’re doing any distinctive
    trick. Moreover, The contents are masterwork.

    you have performed a great activity in this subject!

Comments are closed.