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 loved as much as you’ll receive carried out right here.
    The sketch is tasteful, your authored subject matter stylish.
    nonetheless, you command get got an edginess over that you wish be delivering the following.
    unwell unquestionably come more formerly again as exactly the same nearly a lot often inside case you shield this increase.

  2. I know this web site presents quality based articles or reviews and extra information, is
    there any other web site which offers these stuff in quality?

  3. Write more, thats all I have to say. Literally, it seems as though you relied on the video
    to make your point. You obviously know what youre talking about, why
    waste your intelligence on just posting videos to your weblog when you could be giving us
    something enlightening to read?

  4. You can definitely see your expertise in the work
    you write. The world hopes for even more passionate writers like you who are not afraid to
    say how they believe. All the time go after your heart.

  5. Hey just wanted to give you a quick heads up and let
    you know a few of the images aren’t loading correctly.
    I’m not sure why but I think its a linking issue. I’ve tried it in two different internet
    browsers and both show the same outcome.

  6. It’s going to be finish of mine day, except before ending I am reading this wonderful piece of writing to increase my experience.

  7. I’m amazed, I must say. Seldom do I encounter a blog that’s both
    equally educative and entertaining, and without a doubt, you have hit the nail on the head.
    The issue is something that too few folks are speaking intelligently about.

    Now i’m very happy I found this in my search for something concerning this.

  8. you are truly a excellent webmaster. The site loading speed is amazing.
    It sort of feels that you are doing any distinctive trick.
    Furthermore, The contents are masterpiece. you have performed a
    wonderful task on this topic!

  9. all the time i used to read smaller content which as well clear their motive, and that
    is also happening with this article which I am reading here.

  10. Wonderful post but I was wondering if you could write a litte more on this
    topic? I’d be very grateful if you could elaborate a little bit
    more. Bless you!

  11. I was curious if you ever thought of changing the structure of your site?
    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 1 or two images.
    Maybe you could space it out better?

  12. Pretty nice post. I just stumbled upon your blog and wished to
    say that I have truly enjoyed browsing your blog posts.
    In any case I will be subscribing to your
    rss feed and I hope you write again soon!

  13. Hi there just wanted to give you a quick heads up. The text in your content seem to be running off the screen in Safari.
    I’m not sure if this is a formatting issue or something to do
    with web browser compatibility but I figured I’d post to
    let you know. The design and style look great though!
    Hope you get the issue fixed soon. Cheers

  14. Hi! I just wanted to ask if you ever have any trouble with hackers?
    My last blog (wordpress) was hacked and I ended up
    losing a few months of hard work due to no data backup.
    Do you have any methods to prevent hackers?

  15. Pretty nice post. I just stumbled upon your weblog and
    wished to say that I’ve truly enjoyed browsing your blog posts.

    After all I’ll be subscribing to your rss feed
    and I hope you write again soon!

  16. Heya i am for the first time here. I found this board and I find It truly helpful & it helped me
    out a lot. I hope to present something back and help others like
    you helped me.

  17. Heya i am for the primary time here. I found this board and I in finding It truly helpful &
    it helped me out a lot. I am hoping to offer one thing again and aid others such as you aided me.

  18. Have you ever thought about including a little bit more than just your articles?

    I mean, what you say is valuable and everything. Nevertheless think of if you added some great graphics or video clips to give your posts more, “pop”!
    Your content is excellent but with images and video clips, this site could undeniably be one of the most beneficial
    in its field. Excellent blog!

  19. Magnificent beat ! I wish to apprentice while you amend your site, how can i subscribe for a blog site?
    The account helped me a acceptable deal. I had been tiny
    bit acquainted of this your broadcast provided bright
    clear idea

Comments are closed.