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. Hey there just wanted to give you a brief heads
    up and let you know a few of the pictures aren’t loading properly.
    I’m not sure why but I think its a linking issue. I’ve tried it in two different web browsers and both show the same outcome.

  2. Hi, I do think this is a great blog. I stumbledupon it 😉 I’m going to return yet again since I bookmarked it.
    Money and freedom is the best way to change, may you be rich and continue to guide other people.

  3. I blog often and I truly appreciate your information. This
    great article has truly peaked my interest. I’m going to take a note of
    your site and keep checking for new information about once per week.
    I subscribed to your Feed too.

  4. Incredible! This blog looks exactly like my old one! It’s on a entirely different subject but it has
    pretty much the same layout and design. Outstanding choice of colors!

  5. I am curious to find out what blog system you are using? I’m experiencing some small security issues with
    my latest site and I would like to find something more secure.
    Do you have any solutions?

  6. Does your site have a contact page? I’m having problems locating it but, I’d like
    to send you an email. I’ve got some recommendations for your blog you
    might be interested in hearing. Either way, great blog and I look
    forward to seeing it grow over time.

  7. Having read this I thought it was rather informative.
    I appreciate you taking the time and effort to put this informative article together.
    I once again find myself spending a lot of time both reading and
    leaving comments. But so what, it was still
    worthwhile!

  8. I’ve been browsing on-line more than 3 hours lately, but
    I by no means discovered any interesting
    article like yours. It’s lovely worth enough for me. In my opinion, if all site owners and bloggers made excellent
    content material as you did, the net will probably be much more useful than ever
    before.

  9. A fascinating discussion is definitely worth comment.
    There’s no doubt that that you ought to publish more on this subject,
    it might not be a taboo matter but usually people don’t speak about such issues.

    To the next! Best wishes!!

  10. Right here is the right web site for anybody who wants to understand this topic.
    You understand a whole lot its almost hard to argue with you (not that I personally will
    need to…HaHa). You certainly put a new spin on a subject that’s
    been discussed for many years. Wonderful stuff, just wonderful!

  11. Howdy! I’m at work surfing around your blog from my new iphone 4!
    Just wanted to say I love reading through your blog and look forward to
    all your posts! Keep up the superb work!

  12. It’s a shame you don’t have a donate button! I’d certainly donate to this outstanding blog!
    I suppose for now i’ll settle for bookmarking and adding your RSS feed to my Google account.
    I look forward to new updates and will talk about this blog with my Facebook group.
    Chat soon!

  13. It’s remarkable to visit this web page and reading the views
    of all mates concerning this paragraph, while I am
    also zealous of getting experience.

  14. What i don’t realize is if truth be told how you are not actually a lot more smartly-liked than you may be now.
    You’re very intelligent. You realize therefore significantly when it
    comes to this subject, produced me personally believe it from numerous various angles.
    Its like men and women aren’t interested until it is one thing to do with
    Woman gaga! Your individual stuffs nice. All the
    time maintain it up!

  15. I have been browsing online more than 4 hours today, yet I never found any interesting
    article like yours. It is pretty worth enough for me. In my view, if all web owners and bloggers made good content as you
    did, the web will be much more useful than ever before.

  16. An interesting discussion is worth comment.
    I believe that you need to publish more about this subject matter,
    it may not be a taboo subject but typically folks don’t discuss these issues.
    To the next! Best wishes!!

  17. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point.

    You definitely know what youre talking about, why waste your intelligence
    on just posting videos to your weblog when you could be giving us something informative to read?

Comments are closed.