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. Heya i am for the first time here. I came across this board and I in finding It truly useful & it helped me out much.
    I hope to offer something back and aid others such as you
    aided me.

  2. Write more, thats all I have to say. Literally,
    it seems as though you relied on the video to make your point.
    You clearly know what youre talking about, why waste your intelligence on just posting videos to your blog
    when you could be giving us something enlightening to read?

  3. Hi! I’ve been following your blog for some time now and
    finally got the bravery to go ahead and give you a
    shout out from Atascocita Tx! Just wanted to say keep up the excellent job!

  4. I like the valuable info you provide in your articles.

    I will bookmark your blog and check again here frequently.
    I am quite certain I’ll learn many new stuff right here!
    Best of luck for the next!

  5. Hi 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
    experience so I wanted to get advice from someone with experience.
    Any help would be greatly appreciated!

  6. Howdy, i read your blog occasionally and i own a similar one and i was just wondering if
    you get a lot of spam remarks? If so how do you stop
    it, any plugin or anything you can advise? I get so much lately it’s driving me crazy so any support is very much appreciated.

  7. I’m extremely impressed with your writing skills and also with
    the layout on your blog. Is this a paid theme or did you customize it yourself?

    Either way keep up the excellent quality writing, it is
    rare to see a nice blog like this one these days.

  8. I’ve been surfing online more than 4 hours today, yet I never
    found any interesting article like yours. It’s pretty
    worth enough for me. In my opinion, if all webmasters and
    bloggers made good content as you did, the net will be much more useful than ever before.

  9. Asking questions are actually fastidious thing if you are not understanding something entirely, however this piece of writing offers fastidious understanding yet.

  10. Pretty section of content. I simply stumbled upon your blog and in accession capital
    to say that I get actually loved account your weblog posts.

    Anyway I’ll be subscribing to your feeds or even I
    achievement you get admission to consistently rapidly.

  11. Hi, I do think this is an excellent blog. I stumbledupon it 😉 I am going to return yet again since i have saved as a favorite it.

    Money and freedom is the best way to change, may you be rich and continue to help others.

  12. Hi there, this weekend is good designed for me, as this time i am reading this enormous informative article here at my house.

  13. I take pleasure in, result in I discovered just what I was taking a look for.

    You have ended my 4 day long hunt! God Bless you man. Have a great day.
    Bye

  14. We are a group of volunteers and starting
    a new scheme in our community. Your web site
    offered us with valuable information to work on. You’ve done a formidable
    job and our whole community will be grateful to you.

  15. Hello, i think that i saw you visited my site so i came to “return the favor”.I am trying to
    find things to improve my site!I suppose its ok to use a few of your ideas!!

  16. It’s truly very complicated in this active life to listen news on Television, therefore I only use web for that reason, and
    obtain the newest news.

  17. This is very interesting, You are a very skilled blogger.
    I have joined your feed and look forward to seeking more of your wonderful post.
    Also, I’ve shared your web site in my social networks!

  18. Hi, i think that i saw you visited my weblog thus i came to “return the
    favor”.I’m attempting to find things to enhance my site!I suppose its ok to use some
    of your ideas!!

  19. Having read this I thought it was rather informative.
    I appreciate you taking the time and effort to put this information together.
    I once again find myself spending a significant amount of time both
    reading and commenting. But so what, it was
    still worthwhile!

  20. Hello, i feel that i noticed you visited my site so i got
    here to go back the choose?.I’m attempting to in finding issues to enhance my web site!I guess its good enough
    to make use of a few of your ideas!!

  21. My partner and I stumbled over here coming from a different page and thought
    I might check things out. I like what I see so i am just following you.
    Look forward to going over your web page again.

  22. It’s a shame you don’t have a donate button! I’d without
    a doubt donate to this brilliant blog! I guess for now i’ll settle for bookmarking and adding
    your RSS feed to my Google account. I look forward to brand
    new updates and will talk about this blog with my Facebook group.
    Talk soon!

  23. Pretty component of content. I simply stumbled upon your weblog
    and in accession capital to say that I acquire actually loved account your blog posts.
    Any way I’ll be subscribing in your augment and even I fulfillment you get admission to constantly rapidly.

  24. Hello! I’m at work browsing your blog from my new
    iphone 3gs! Just wanted to say I love reading through
    your blog and look forward to all your posts! Keep up the fantastic
    work!

  25. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point.
    You obviously know what youre talking about, why waste your intelligence on just posting videos to your site when you could be giving us something enlightening to read?

  26. Hi my loved one! I want to say that this article is amazing, great written and
    include almost all important infos. I’d like to see more posts like this
    .

  27. Howdy this is kinda of off topic but I was wondering
    if blogs use WYSIWYG editors or if you have to manually code with HTML.
    I’m starting a blog soon but have no coding knowledge so I wanted
    to get guidance from someone with experience. Any help would be enormously appreciated!

  28. I’ve been surfing online more than three hours as of late, yet I never discovered any attention-grabbing
    article like yours. It is lovely worth enough for me.
    In my opinion, if all web owners and bloggers made excellent content material
    as you probably did, the internet can be much more useful than ever before.

  29. Hello there! I could have sworn I’ve been to this web site before but after going
    through some of the posts I realized it’s new to me.

    Nonetheless, I’m definitely delighted I found it and I’ll be book-marking it and checking back
    frequently!

  30. Howdy just wanted to give you a quick heads up. The words in your content seem
    to be running off the screen in Opera. I’m not sure if
    this is a format issue or something to do with browser compatibility but I figured I’d post to let you know.
    The layout look great though! Hope you get the problem resolved soon. Cheers

Comments are closed.