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. Hey there! I could have sworn I’ve been to this blog before but after checking through some of
    the post I realized it’s new to me. Anyways, I’m definitely glad I found it
    and I’ll be bookmarking and checking back often!

  2. I was wondering if you ever considered 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 one or 2 pictures.

    Maybe you could space it out better?

  3. Link exchange is nothing else but it is only placing the other
    person’s weblog link on your page at proper place and other person will also do
    similar in favor of you.

  4. Have you ever thought about publishing an e-book or guest authoring on other blogs?
    I have a blog based on the same subjects you discuss
    and would love to have you share some stories/information. I
    know my readers would value your work. If you’re even remotely interested, feel free to shoot me
    an email.

  5. Hmm is anyone else experiencing problems with the images
    on this blog loading? I’m trying to figure out
    if its a problem on my end or if it’s the blog. Any suggestions would be greatly appreciated.

  6. Today, I went to the beach front 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 placed 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 completely off topic but I
    had to tell someone!

  7. certainly like your web-site however you have to take a
    look at the spelling on several of your posts.
    Many of them are rife with spelling issues and I find
    it very troublesome to inform the reality then again I will certainly
    come back again.

  8. I am curious to find out what blog platform you happen to be working with?
    I’m experiencing some small security problems with my latest blog and I’d like to
    find something more risk-free. Do you have any recommendations?

  9. I don’t even know the way I finished up here, however I thought this submit
    was once great. I do not know who you might be however definitely
    you’re going to a well-known blogger in case you are not already.
    Cheers!

  10. Hey just wanted to give you a quick heads up and let you know a few of
    the images aren’t loading properly. 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.

  11. I think that what you said made a lot of sense. But, consider this, what
    if you wrote a catchier post title? I ain’t saying your information is not good, but suppose
    you added something that makes people desire more?
    I mean Contoh Soal Pemrograman – Pola Segitiga Siku-siku – Umar faisol is
    kinda vanilla. You might peek at Yahoo’s front page and note how they create article headlines to get viewers interested.
    You might add a related video or a related picture or two to
    grab people interested about everything’ve got to say. In my opinion, it could bring your posts a little bit more interesting.

  12. I’m not sure exactly why but this site is loading extremely slow for me.
    Is anyone else having this issue or is it a problem on my end?
    I’ll check back later on and see if the problem still exists.

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

  14. Do you mind if I quote a couple of your posts as long as I
    provide credit and sources back to your blog? My blog is
    in the very same niche as yours and my visitors would certainly benefit from
    some of the information you present here. Please let
    me know if this ok with you. Regards!

  15. Hello, i believe that i noticed you visited my blog so i came to go
    back the prefer?.I am trying to to find issues to enhance my site!I assume its good
    enough to use some of your ideas!!

  16. After going over a handful of the articles on your blog, I truly appreciate your way of blogging.
    I book marked it to my bookmark webpage list and will be checking back soon. Please visit my web site
    too and tell me what you think.

  17. Wow that was unusual. I just wrote an very long comment but
    after I clicked submit my comment didn’t appear.
    Grrrr… well I’m not writing all that over again. Anyhow,
    just wanted to say great blog!

  18. What’s up to every one, the contents present at this site are in fact
    remarkable for people knowledge, well, keep up the nice
    work fellows.

  19. Great blog here! Also your site loads up
    very fast! What host are you using? Can I get your affiliate link to your host?
    I wish my site loaded up as fast as yours lol

  20. Hello there, You have done an incredible job.
    I’ll certainly digg it and personally suggest to my friends.
    I am confident they’ll be benefited from this site.

  21. For the reason that the admin of this web page is working,
    no doubt very rapidly it will be well-known, due to its quality contents.

  22. Its like you read my mind! You appear to know a lot about this, like you wrote the book in it or something.
    I think that you can do with a few pics to drive the message
    home a little bit, but other than that, this is fantastic blog.
    A fantastic read. I’ll certainly be back.

  23. Hey there just wanted to give you a quick heads up.
    The words in your content seem to be running off the screen in Chrome.
    I’m not sure if this is a format issue or something to do with web browser
    compatibility but I thought I’d post to let you know.
    The design and style look great though! Hope you get
    the issue solved soon. Kudos

Comments are closed.