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.

48,210 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. Today, I went to the beach 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 entirely
    off topic but I had to tell someone!

  2. Do you mind if I quote a couple of your posts as long as I provide credit and sources back to your weblog?
    My blog is in the exact same area of interest as yours and my
    users would genuinely benefit from some of the information you present here.
    Please let me know if this alright with you. Thanks a lot!

  3. Its like you read my thoughts! You seem to grasp a
    lot approximately this, such as you wrote the guide in it or something.
    I think that you just could do with a few % to drive the message house a little bit, however instead of that, that is wonderful blog.
    A fantastic read. I’ll certainly be back.

  4. With havin so much written content do you ever run into any problems of plagorism or copyright violation?
    My blog 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 authorization. Do you
    know any methods to help reduce content from being stolen? I’d definitely appreciate it.

  5. I think this is one of the most significant info for me. And
    i am glad reading your article. But wanna remark on few general things, The website style is wonderful, the articles is really excellent : D.

    Good job, cheers

  6. of course like your web-site however you need to take a look at the spelling on several of
    your posts. Many of them are rife with spelling issues
    and I in finding it very troublesome to tell the reality however I’ll definitely come
    back again.

  7. I like the valuable info you provide in your articles.
    I will bookmark your blog and check again here frequently.
    I am quite certain I will learn many new stuff right here!

    Best of luck for the next!

  8. My partner and I stumbled over here coming from a different website and thought I
    might as well check things out. I like what I see
    so now i’m following you. Look forward to looking at your web page yet again.

  9. You actually make it seem so easy with your presentation but I find this matter to be actually
    something that I think I would never understand.
    It seems too complicated and very broad for me.

    I’m looking forward for your next post, I’ll
    try to get the hang of it!

  10. Have you ever considered about including a little bit more than just your
    articles? I mean, what you say is important and
    all. But think about if you added some great images or videos to give
    your posts more, “pop”! Your content is excellent
    but with images and videos, this site could definitely be one of the very best in its field.
    Fantastic blog!

  11. You’re so awesome! I do not believe I have read through something like this before.
    So wonderful to find someone with a few original thoughts on this topic.

    Seriously.. many thanks for starting this up. This web site is one thing
    that’s needed on the internet, someone with some originality!

  12. Howdy would you mind stating which blog platform you’re using?

    I’m going to start my own blog soon but I’m having a difficult time deciding between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your design and style seems different
    then most blogs and I’m looking for something completely unique.
    P.S Sorry for getting off-topic but I had to ask!

  13. hey there and thank you for your information – I have certainly picked up something new from right
    here. I did however expertise some technical points using this web site, as I experienced to reload the site many times previous to I could get it
    to load properly. I had been wondering if your web host is
    OK? Not that I am complaining, but sluggish loading instances times will very frequently affect your placement
    in google and could damage your quality score if advertising and marketing with Adwords.
    Anyway I’m adding this RSS to my e-mail and can look out for
    a lot more of your respective exciting content.
    Make sure you update this again very soon.

  14. For latest news you have to pay a visit world-wide-web and on web I found
    this site as a finest site for most recent updates.

  15. Pretty section of content. I just stumbled upon your weblog
    and in accession capital to assert that I get actually enjoyed account your blog posts.
    Any way I’ll be subscribing to your feeds and
    even I achievement you access consistently quickly.

  16. Hi there! Someone in my Myspace group shared this website
    with us so I came to take a look. I’m definitely loving the information. I’m book-marking and will be tweeting
    this to my followers! Exceptional blog and great design.

  17. Heya fantastic blog! Does running a blog similar to this take a lot of work?
    I have absolutely no knowledge of computer programming but I was hoping to start my own blog in the
    near future. Anyways, should you have any suggestions or techniques for new blog owners please share.
    I know this is off topic nevertheless I just wanted to
    ask. Kudos!

  18. Very nice post. I just stumbled upon your weblog and wished to say that I’ve truly enjoyed surfing around your blog posts.

    In any case I will be subscribing to your rss feed and I
    hope you write again soon!

  19. 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 blog when you could be giving us something informative to read?

  20. What’s Happening i’m new to this, I stumbled upon this I
    have discovered It absolutely useful and
    it has helped me out loads. I’m hoping to give a contribution & aid other customers like its helped me.
    Great job.

  21. Hi fantastic website! Does running a blog like this require a massive amount work?
    I have absolutely no knowledge of computer programming however I
    had been hoping to start my own blog soon. Anyhow, should you have any recommendations or techniques for new blog owners please share.
    I understand this is off subject but I just had to ask. Appreciate it!

  22. Hi would you mind letting me know which hosting company you’re
    utilizing? I’ve loaded your blog in 3 completely
    different web browsers and I must say this blog loads a lot faster
    then most. Can you suggest a good hosting provider at a honest price?
    Cheers, I appreciate it!

  23. Hey! I know this is somewhat off topic but I was wondering which blog platform are you using for this
    website? I’m getting fed up of WordPress because I’ve had
    problems with hackers and I’m looking at options for another platform.

    I would be great if you could point me in the direction of a good platform.

Comments are closed.