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. Fantastic beat ! I would like to apprentice at
    the same time as you amend your web site, how could i subscribe for a weblog site?

    The account aided me a applicable deal. I had been a little bit acquainted of this your broadcast offered bright clear
    idea

  2. Hello, i think that i saw you visited my blog
    thus i got here to go back the favor?.I’m trying to
    to find issues to enhance my site!I guess its adequate to make use
    of some of your ideas!!

  3. Pretty section of content. I just stumbled upon your blog and
    in accession capital to assert that I acquire actually enjoyed account your blog posts.
    Any way I will be subscribing to your feeds and
    even I achievement you access consistently fast.

  4. Hi there, i read your blog from time to time and i own a similar one and
    i was just curious if you get a lot of spam responses? If so how do you protect against it, any plugin or anything you can suggest?
    I get so much lately it’s driving me crazy so any assistance is very much appreciated.

  5. If some one wants expert view concerning running a blog then i advise him/her to pay a quick visit
    this webpage, Keep up the pleasant work.

  6. Hi, I would like to subscribe for this blog to obtain most recent updates,
    thus where can i do it please help out.

  7. Do you mind if I quote a couple of your articles as long as I
    provide credit and sources back to your webpage?
    My blog site is in the exact same niche as yours and my users
    would certainly benefit from a lot of the information you present here.
    Please let me know if this okay with you. Appreciate it!

  8. An intriguing discussion is definitely worth comment.
    I think that you should publish more about this topic,
    it may not be a taboo matter but generally people don’t talk about these subjects.
    To the next! Cheers!!

  9. Pretty great post. I simply stumbled upon your weblog and wished
    to say that I have truly enjoyed browsing your weblog posts.

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

  10. You made some decent points there. I checked on the web to learn more
    about the issue and found most individuals will go along with your views on this web site.

  11. I do not know if it’s just me or if perhaps everyone else
    encountering issues with your site. It appears as though some of the written text on your posts are running off the
    screen. Can somebody else please provide feedback and let me know if this is happening to them too?
    This might be a problem with my browser because I’ve had this happen previously.

    Kudos

  12. Hi there! This is my first visit to your blog! We are a team of volunteers and
    starting a new initiative in a community in the same niche.

    Your blog provided us useful information to work on. You have done a marvellous job!

  13. I’ve read several excellent stuff here. Certainly value
    bookmarking for revisiting. I wonder how so much attempt you set to create this sort of wonderful informative web site.

  14. What’s up friends, how is the whole thing, and what you wish for to say concerning this paragraph,
    in my view its actually remarkable in support of me.

  15. Hi there! Someone in my Facebook group shared this site with us so
    I came to give it a look. I’m definitely enjoying the information. I’m bookmarking and will
    be tweeting this to my followers! Wonderful blog
    and outstanding style and design.

  16. I have been exploring for a little for any high quality
    articles or blog posts in this kind of area .
    Exploring in Yahoo I finally stumbled upon this web site.
    Reading this information So i’m happy to show that I have a
    very just right uncanny feeling I discovered exactly what I needed.
    I so much undoubtedly will make sure to do not forget this site and give it a
    glance on a constant basis.

  17. When I originally left a comment I seem to have clicked the -Notify me when new comments
    are added- checkbox and now whenever a comment is added I get four emails
    with the exact same comment. Perhaps there
    is a way you are able to remove me from that service? Kudos!

  18. Wow that was unusual. I just wrote an incredibly long comment
    but after I clicked submit my comment didn’t show up.

    Grrrr… well I’m not writing all that over again. Anyhow, just wanted
    to say superb blog!

  19. Ahaa, its good discussion concerning this article at this place at this blog,
    I have read all that, so at this time me also commenting at this place.

  20. Hi, i read your blog occasionally and i own a similar one and i was just
    wondering if you get a lot of spam comments? If so how do
    you reduce it, any plugin or anything you can suggest? I get so much
    lately it’s driving me insane so any support is very much appreciated.

  21. Aw, this was an exceptionally nice post. Finding the time and actual effort to make a very good article… but what can I say… I procrastinate a lot and don’t seem to get anything done.

  22. What’s Happening i am new to this, I stumbled upon this I’ve
    found It positively useful and it has aided me out loads.
    I am hoping to contribute & help other customers like its aided me.
    Good job.

Comments are closed.