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. Hi there, its nice piece of writing concerning media
    print, we all know media is a enormous source of data.

  2. Hi, I do think this is an excellent blog. I stumbledupon it 😉 I’m
    going to revisit once again since I bookmarked it.
    Money and freedom is the best way to change, may you be rich and continue to guide others.

  3. Hello, i think that i noticed you visited my web site thus i got here to go back the choose?.I am trying to
    find things to improve my web site!I suppose its ok to make use of a few of
    your ideas!!

  4. I do not know whether it’s just me or if perhaps everybody else encountering problems
    with your blog. It seems like some of the written text on your content
    are running off the screen. Can someone else
    please comment and let me know if this is happening to them as well?
    This may be a issue with my browser because I’ve had
    this happen previously. Cheers

  5. Pretty nice post. I just stumbled upon your weblog and wished to
    say that I’ve truly enjoyed browsing your blog posts.
    After all I’ll be subscribing to your feed
    and I hope you write again soon!

  6. Its like you read my thoughts! You appear to grasp so much approximately this, such
    as you wrote the guide in it or something. I think that you just can do with a few percent to force the message
    house a little bit, however other than that, that is excellent blog.
    A fantastic read. I’ll definitely be back.

  7. Hello would you mind letting me know which web host you’re using?

    I’ve loaded your blog in 3 completely different internet
    browsers and I must say this blog loads a lot faster then most.

    Can you suggest a good internet hosting provider at a reasonable price?
    Kudos, I appreciate it!

  8. you’re truly a good webmaster. The web site loading speed is incredible.
    It seems that you’re doing any unique trick. In addition, The contents are
    masterwork. you have performed a excellent task in this topic!

  9. Appreciating the dedication you put into your blog and detailed information you present.

    It’s great to come across a blog every once in a while that isn’t the same
    out of date rehashed information. Excellent read! I’ve
    saved your site and I’m including your RSS feeds to my Google account.

  10. I have been surfing online more than three hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. Personally, if all web owners and bloggers made good content as you did, the web will be a lot more useful than ever before.|

  11. Hi, I do believe this is a great site. I stumbledupon it 😉 I am going to revisit yet
    again since I saved as a favorite it. Money and freedom is the greatest way to change, may you be rich
    and continue to guide other people.

  12. Hey there, I think your blog might be having browser compatibility issues.
    When I look at your blog site in Ie, it looks fine but when opening in Internet Explorer, it has
    some overlapping. I just wanted to give you a quick heads up!
    Other then that, wonderful blog!

  13. Aw, this was a very good post. Finding the time and actual effort to produce a very good article… but what can I say… I hesitate a lot and don’t seem to get nearly anything done.

  14. Hey! This is kind of off topic but I need some guidance 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 fast. I’m thinking about
    setting up my own but I’m not sure where to start.
    Do you have any tips or suggestions? Appreciate it

  15. Hеy just wanted to give you a quick headѕ սp. The text in your content seem to be running off the screen in Ie.
    I’m not surе if this iѕ a format issue oг something to dԁo with browser compɑtibility but I fiցured I’d post to let you know.
    The ѕtyle ɑnd design look grsat though! Hope you get
    tһhe issue resolved soon. Cheers http://wiki.lynthornealder.com/index.php?title=Agen_Pragmatic88_WAHANA138:_Daftar_Situs_Agen_Slot_Online_Pragmatic_88_Terbaik_Dan_Terpopuler

  16. I’m gone to say to my little brother, that he should also go to see
    this web site on regular basis to get updated from most recent reports.

  17. Hi mates, how is the whole thing, and what you wish for
    to say concerning this paragraph, in my view its in fact amazing for me.

Comments are closed.