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. I have been browsing online more than 2 hours today, yet I never found any interesting
    article like yours. It’s pretty worth enough for me. Personally, if all web owners and bloggers made good content as you did,
    the internet will be much more useful than ever before.

  2. I got this site from my friend who shared with me regarding
    this web page and now this time I am browsing this web site and reading very informative content at
    this place.

  3. Link exchange is nothing else however it is simply placing the other
    person’s blog link on your page at proper place and other person will also do same in favor of you.

  4. Great beat ! I would like to apprentice while you amend your web site,
    how could i subscribe for a blog site? The account helped me a acceptable deal.
    I had been tiny bit acquainted of this your broadcast offered bright clear concept

  5. Good day! Do you use Twitter? I’d like to follow you if that would be ok.
    I’m definitely enjoying your blog and look forward
    to new updates.

  6. What i do not understood is if truth be told how you are no longer actually much more neatly-appreciated than you may be right now.
    You are so intelligent. You know thus significantly relating to this matter,
    made me for my part consider it from a lot of numerous angles.
    Its like women and men aren’t interested unless it
    is one thing to accomplish with Woman gaga!
    Your individual stuffs great. At all times care for it up!

  7. Everyone loves what you guys are usually up too. This type of clever work and coverage!

    Keep up the wonderful works guys I’ve incorporated
    you guys to my own blogroll.

  8. I’m amazed, I must say. Rarely do I encounter a blog that’s both equally educative and interesting, and without a doubt,
    you have hit the nail on the head. The issue is something not enough people are speaking
    intelligently about. I am very happy I came across this in my search for something
    regarding this.

  9. Attractive element of content. I just stumbled upon your web site and in accession capital to assert
    that I get actually enjoyed account your blog posts. Any way I will be
    subscribing to your augment and even I success you get entry
    to persistently fast.

  10. Whats up this is kind of 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 advice from someone with experience.

    Any help would be greatly appreciated!

  11. I have been exploring for a bit for any high quality articles or weblog posts in this
    kind of space . Exploring in Yahoo I at last stumbled upon this site.
    Reading this info So i’m glad to exhibit that I have
    a very excellent uncanny feeling I found out exactly what I needed.
    I most without a doubt will make certain to do not omit this web site and
    give it a glance regularly.

  12. I read this paragraph fully on the topic of the difference of newest and preceding technologies,
    it’s remarkable article.

  13. Yesterday, while I was at work, my sister stole my
    iphone and tested to see if it can survive a thirty foot drop, just so
    she can be a youtube sensation. My iPad is now broken and she has 83 views.
    I know this is entirely off topic but I had to share it with someone!

  14. A motivating discussion is definitely worth comment. I do think that you should publish more on this issue,
    it may not be a taboo subject but typically
    people don’t discuss such issues. To the next! Best wishes!!

  15. You need to take part in a contest for one of the best blogs
    on the net. I am going to highly recommend this site!

Comments are closed.