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. Generally I don’t learn post on blogs, but I would like to say that this write-up very
    forced me to try and do so! Your writing style has been amazed me.

    Thank you, quite nice post.

  2. I have read so many content concerning the blogger lovers however this post is in fact a pleasant piece of writing, keep it up.

  3. I got this web page from my buddy who informed
    me about this website and now this time I am browsing this website and reading very informative articles or reviews at this place.

  4. It’s a pity you don’t have a donate button! I’d certainly donate to this fantastic blog!

    I suppose for now i’ll settle for book-marking and adding your RSS feed to my
    Google account. I look forward to new updates and will
    share this blog with my Facebook group. Chat soon!

  5. I am in fact pleased to glance at this webpage posts which consists of plenty of useful data, thanks
    for providing such data.

  6. I’ve been exploring for a bit for any high quality articles or blog
    posts in this sort of area . Exploring in Yahoo I at last stumbled upon this web site.
    Studying this information So i am glad to express that I have an incredibly good uncanny feeling I found
    out just what I needed. I such a lot surely will make sure to do not
    omit this web site and give it a glance on a continuing basis.

  7. I just could not go away your website prior to suggesting that I extremely loved the standard information an individual supply to your
    guests? Is gonna be again ceaselessly to investigate cross-check
    new posts

  8. Hi, Neat post. There’s a problem along with your site in internet explorer, may
    test this? IE still is the marketplace leader and a huge element of people
    will miss your fantastic writing due to this problem.

  9. Hmm it seems like your site ate my first comment (it was super
    long) so I guess I’ll just sum it up what I wrote and say, I’m thoroughly enjoying your blog.
    I too am an aspiring blog writer but I’m still new to everything.
    Do you have any tips for first-time blog writers?
    I’d really appreciate it.

  10. Hey there would you mind stating which blog platform you’re working with?
    I’m going to start my own blog soon but I’m having a difficult time making a decision between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your layout seems
    different then most blogs and I’m looking for
    something completely unique. P.S My apologies for getting off-topic but I had
    to ask!

  11. Whats up this is somewhat 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 expertise so I
    wanted to get guidance from someone with experience. Any help would be enormously appreciated!

  12. Hi this is somewhat 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 skills so I wanted to get
    guidance from someone with experience. Any help would be enormously appreciated!

  13. I’m extremely impressed with your writing skills as well as
    with the layout on your blog. Is this a paid theme or did you customize it yourself?
    Anyway keep up the nice quality writing, it’s rare to see a great blog like this one these days.

  14. Have you ever considered writing an ebook
    or guest authoring on other websites? I have a blog
    based on the same subjects you discuss and would really like
    to have you share some stories/information. I know my audience would enjoy your work.
    If you are even remotely interested, feel free to shoot me an email.

  15. I will right away clutch your rss feed as I
    can not to find your e-mail subscription link or newsletter service.
    Do you’ve any? Kindly let me recognise in order that I
    could subscribe. Thanks.

  16. Hello I am so happy I found your blog, I really found you by mistake,
    while I was looking on Askjeeve for something else, Nonetheless I am here now and
    would just like to say thanks a lot for a incredible post
    and a all round exciting blog (I also love the theme/design), I donÒ€ℒt
    have time to read through it all at the minute but I have saved it and also added in your RSS feeds, so when I have time I will be back
    to read a lot more, Please do keep up the awesome jo.

  17. Excellent post. I was checking continuously this blog and I’m inspired!

    Very useful info particularly the remaining
    section πŸ™‚ I deal with such information a lot. I was looking for this certain information for a long time.
    Thanks and best of luck.

  18. Whats up this is kinda 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 skills so
    I wanted to get advice from someone with experience.
    Any help would be greatly appreciated!

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

  20. I am really inspired together with your writing abilities as smartly as with the layout
    to your blog. Is this a paid subject matter or did you modify it yourself?
    Anyway stay up the nice quality writing, it is uncommon to see a great blog like this one nowadays..

  21. Excellent blog right here! Also your web site lots up very fast!
    What web host are you the usage of? Can I get your associate link to your host?
    I want my web site loaded up as quickly as yours lol

Comments are closed.