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. If some one wishes expert view concerning blogging and site-building after that i recommend him/her to visit this weblog, Keep up the pleasant job.|

  2. I relish, result in I found exactly what I was taking a look for.
    You have ended my 4 day lengthy hunt! God Bless you man. Have a
    great day. Bye

  3. Hey! This is kind of off topic but I need some advice from an established blog.
    Is it tough to set up your own blog? I’m not very techincal but
    I can figure things out pretty quick. I’m thinking about setting up my own but I’m not sure where to begin. Do you
    have any ideas or suggestions? Appreciate it

  4. Aw, this was an exceptionally good post. Taking the time and actual effort to produce
    a very good article… but what can I say… I put things off
    a whole lot and don’t manage to get nearly anything done.

  5. You could definitely see your skills within the work you write.
    The arena hopes for even more passionate writers such as you who aren’t
    afraid to mention how they believe. At all times go after your heart.

  6. We’re a gaggle of volunteers and starting a new scheme in our community.

    Your site offered us with helpful information to work on. You’ve performed a formidable task and our entire community will likely be grateful to
    you.

  7. Wow, wonderful blog layout! How lengthy have you been running a
    blog for? you made running a blog glance easy.
    The total glance of your site is fantastic, let
    alone the content!

  8. It’s perfect time to make a few plans for the long run and it
    is time to be happy. I have learn this post and if I may just I desire to recommend you few
    interesting issues or suggestions. Perhaps you can write subsequent articles regarding this article.
    I desire to read even more things approximately it!

  9. Heya i’m for the first time here. I found this board and I find
    It truly helpful & it helped me out much. I am hoping to offer one
    thing again and aid others like you helped me.

  10. Hi there, I do believe your web site could be having internet browser compatibility issues.
    When I take a look at your web site in Safari, it looks fine
    however when opening in I.E., it has some overlapping issues.
    I merely wanted to give you a quick heads up!

    Besides that, wonderful site!

  11. Hey there 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 know-how so
    I wanted to get advice from someone with experience. Any help would be enormously appreciated!

  12. I enjoy what you guys are up too. This sort
    of clever work and exposure! Keep up the very
    good works guys I’ve you guys to our blogroll.

  13. I truly love your site.. Very nice colors & theme. Did you make this amazing site yourself?
    Please reply back as I’m planning to create my very
    own site and want to know where you got this from or just
    what the theme is called. Cheers!

  14. Why viewers still make use of to read news papers when in this technological
    globe everything is presented on web?

  15. It’s a shame you don’t have a donate button! I’d definitely 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 site with my Facebook group.
    Chat soon!

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

  17. A motivating discussion is worth comment. There’s no doubt that
    that you ought to publish more about this subject, it may not
    be a taboo matter but usually folks don’t speak about such issues.

    To the next! Cheers!!

  18. excellent points altogether, you simply gained a brand new reader.
    What would you recommend in regards to your submit that you
    simply made a few days in the past? Any certain?

  19. Heya i’m for the first time here. I found this board
    and I to find It truly useful & it helped me out much.

    I’m hoping to provide one thing again and aid others
    such as you aided me.

  20. Howdy! Do you use Twitter? I’d like to follow you if that would be ok.
    I’m undoubtedly enjoying your blog and look forward
    to new updates.

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

Comments are closed.