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 need 2 set up wordpess through a webhost…. . i know i have to download wordpress but whats a good host to go with? and after i set up an account with a host, how difficult is the set up before I can begin building a site? and last but not least, can i still import the free wordpress templates?.

  2. I am asking for my mother. She doesn’t necessarily want to make money off them, her purpose is to use her blog (once popular) and use it as references to possibly help her get a newspaper article. She has a title for one called “Answers to Life’s Problems”. Where can she post blogs and they become popular? She posted it already on WordPress but there are 3 million people posting blogs hers gets lost in the mix. Any suggestions?.

  3. I’ve been exploring for a little for any high quality articles or blog posts on this kind of area .
    Exploring in Yahoo I at last stumbled upon this site.
    Reading this info So i am glad to convey that I’ve a very good uncanny feeling I discovered
    just what I needed. I most without a doubt will make certain to do
    not put out of your mind this site and provides it a look on a continuing
    basis.

  4. I am curious to find out what blog platform you happen to be utilizing?
    I’m experiencing some small security issues with my latest site and I would
    like to find something more safe. Do you have
    any suggestions?

  5. I recently got a blogspot for my mixtapes that I uploaded but when I search my DJ name (even full url), it doesn’t appear in the google search. Does it take about a week for it to appear or do I have to pay to get it to come up?.

  6. Is there a degree that exists for use of music AND creative writing two fields? If there is, do you know the name of it?. . I want to combine these two of my interests (loves) but I don’t know what kind of degree offers the use of both.. . Please help? Approaching college?.

  7. Hello, i read your blog occasionally and i own a similar one and i was just curious if you get
    a lot of spam feedback? If so how do you protect against it, any plugin or anything you can recommend?
    I get so much lately it’s driving me mad so
    any help is very much appreciated.

  8. Hey there! I just wanted to ask if you ever have any issues with hackers?

    My last blog (wordpress) was hacked and I ended up losing several weeks of hard work due
    to no data backup. Do you have any methods to protect against
    hackers?

    Feel free to visit my site … slotpulsa888.xyz

  9. I have had Firefox, IE, and Google chrome downloaded onto my computer for a while now with no problem. Recently I downloaded YIM and now Firefox doesn’t start up. If I restart my computer a few times, and try to open it a few dozen times each time I restart, it will eventually pop up. How do I fix it? Chrome and IE still work fine but I prefer Firefox..

  10. I sign into my Tumblr account, and switch the dashboard from my main blog to the secondary blog, then I go to Account > Preferences > Customize your blog, but then it just takes me to the customization page for my main blog. Any way to customize my secondary blog, or should I just create a second account altogether?.

  11. I just arrived in Chiang Mai. I wanted to post on my blog, at Blogspot, but all of the headings are now in Thai, not English. Is the problem with my computer, or the hotel’s wi-fi service, or what? How can I get things back to English again?.

  12. Hello, i think that i saw you visited my site thus i came to “return the favor”.I am attempting to
    find things to improve my web site!I suppose its ok
    to use some of your ideas!!

  13. Hey there this is kind of of off topic but I was wanting to know if
    blogs use WYSIWYG editors or if you have to manually code with HTML.
    I’m starting a blog soon but have no coding knowledge so
    I wanted to get guidance from someone with experience.
    Any help would be enormously appreciated!

  14. Have you ever thought about including a little bit more than just your articles?
    I mean, what you say is valuable and everything. But think about if you added some great photos or video clips
    to give your posts more, “pop”! Your content is excellent but
    with pics and videos, this blog could definitely be one
    of the most beneficial in its field. Amazing blog!

Comments are closed.