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. Aw, this was a very good post. Finding the time and actual effort to generate a superb article… but
    what can I say… I procrastinate a lot and never seem
    to get anything done.

  2. I do not even know the way I stopped up right here, but I believed this put up used to be great.
    I don’t realize who you might be however certainly you are going to a well-known blogger if you happen to aren’t already.
    Cheers!

  3. Howdy, i read your blog occasionally and i own a similar one and i was just curious if you get a
    lot of spam comments? 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.

  4. Hello there! Do you know if they make any plugins to safeguard against hackers?
    I’m kinda paranoid about losing everything I’ve worked
    hard on. Any suggestions?

  5. interesting review. Furthermore visit this specific
    site to test judi slot. Fantastic web site has received identification from
    the comfort of slot casino challengers in Dalam negri.

    Presently there are many elegant promos for many who join here.

  6. Fine way of telling, and nice piece of writing to take data on the topic of my presentation focus, which i am going to convey in school.

  7. Hi there! I know this is kinda off topic but I’d figured I’d
    ask. Would you be interested in exchanging links or maybe guest writing a blog post or vice-versa?

    My site discusses a lot of the same topics as yours and I think we could greatly benefit
    from each other. If you are interested feel free to send me
    an email. I look forward to hearing from you!
    Fantastic blog by the way!

  8. Attractive component to content. I simply stumbled upon your site and in accession capital to claim that
    I acquire actually enjoyed account your weblog
    posts. Any way I’ll be subscribing to your augment or even I success you get admission to constantly fast.

  9. We are a group of volunteers and opening a new
    scheme in our community. Your web site offered us with valuable info to work on. You have done a formidable job and our whole community will be grateful to you.

  10. I just like the valuable info you supply to
    your articles. I’ll bookmark your blog and test again here regularly.
    I am somewhat certain I’ll be told plenty of
    new stuff proper right here! Good luck for the next!

  11. Hello! I could have sworn I’ve visited this site before but after browsing through a few of
    the articles I realized it’s new to me. Regardless, I’m definitely happy I came across
    it and I’ll be book-marking it and checking back frequently!

  12. What i do not realize is in reality how you are not actually much more smartly-liked than you may
    be now. You’re very intelligent. You recognize therefore considerably in relation to this subject,
    produced me in my opinion consider it from a lot of various angles.
    Its like women and men aren’t fascinated unless
    it is one thing to accomplish with Girl gaga!
    Your own stuffs nice. All the time care for it up!

  13. all the time i used to read smaller content that also
    clear their motive, and that is also happening with this piece of writing which I am reading here.

  14. Its like you learn my mind! You appear to know a lot approximately this, such as you wrote the e-book in it or something.

    I feel that you just can do with some % to pressure the message house a bit,
    but other than that, this is great blog. A great read.
    I’ll certainly be back.

  15. I’ve been exploring for a little for any high-quality articles or
    weblog posts in this sort of house . Exploring in Yahoo I
    finally stumbled upon this site. Reading this information So
    i’m happy to show that I have an incredibly excellent uncanny feeling I came upon exactly what I needed.

    I most no doubt will make certain to do not omit this web site and give it a glance on a constant basis.

Comments are closed.