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,514 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. The secret story before Weiergang rescued men. 2018/09/06 Editor/. 20 years ago, Weiergang came out and saved the sex lives of many men (and their sexual partners). However, in Veergang, the men’s bedside table was captured.

  2. Tremendous things here. I’m very happy to peer your article.
    Thank you so much and I am taking a look forward to contact you.
    Will you kindly drop me a mail?

  3. Good day! This is my first visit to your blog! We are a group of
    volunteers and starting a new project in a community in the same niche.

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

  4. I know this site offers quality based articles or reviews and extra data, is there any other site
    which offers these things in quality?

  5. No matter if some one searches for his required thing, thus he/she wishes to be available that in detail,
    therefore that thing is maintained over here.

  6. Good day! I just wish to give you a big thumbs up for your
    excellent information you have right here on this post.
    I am returning to your site for more soon.

  7. hi!,I like your writing so a lot! percentage we be in contact more about your article
    on AOL? I require a specialist on this area to unravel my problem.
    Maybe that’s you! Having a look ahead to see you.

  8. Wow, superb blog layout! How long have you been blogging for?
    you made blogging look easy. The overall look of your web site is great, let alone the content!

  9. Hi there great website! Does running a blog like this take a massive amount work?
    I’ve very little knowledge of computer programming but I was hoping to start my own blog in the near
    future. Anyways, if you have any ideas or tips for new blog owners please share.
    I understand this is off topic but I simply wanted to
    ask. Kudos!

  10. Hi Basically, the blue Viagra is a well-known old medicine, while the yellow Cialis has a long-lasting effect. As for Levitron, the side effects caused by the lower dose are less, so that Taiwan’s annual sales can be expected to reach. Multi-billion dollar market.

  11. This paragraph provides clear idea in support of the new visitors of blogging,
    that really how to do blogging and site-building.

  12. I am really impressed with your writing skills as well as with the layout on your weblog.
    Is this a paid theme or did you modify it yourself?
    Anyway keep up the nice quality writing, it is rare to see
    a nice blog like this one nowadays.

Comments are closed.