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

  1. Fantastic beat ! I would like to apprentice even as you
    amend your web site, how could i subscribe for a blog web site?
    The account aided me a appropriate deal. I were a
    little bit acquainted of this your broadcast provided bright transparent idea

  2. Yesterday, while I was at work, my cousin stole my
    iPad and tested to see if it can survive a 25 foot drop, just so she can be a youtube sensation. My apple ipad is
    now destroyed and she has 83 views. I know this is totally off topic but I had to share it with someone!

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

  4. fantastic put up, very informative. I’m wondering why the other experts of
    this sector don’t realize this. You should proceed your writing.
    I’m sure, you’ve a great readers’ base already!

  5. Hey there, I think your site might be having browser compatibility issues.
    When I look at your blog site in Chrome, 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, terrific blog!

  6. Does your blog have a contact page? I’m having problems locating
    it but, I’d like to shoot 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 develop over time.

  7. Having read this I believed it was very informative. I appreciate you spending some time and energy to put this content together.
    I once again find myself spending way too much time both reading and
    leaving comments. But so what, it was still worthwhile!

  8. Heya! I just wanted to ask if you ever have any trouble with hackers?
    My last blog (wordpress) was hacked and I ended up
    losing many months of hard work due to no data backup.
    Do you have any methods to stop hackers?

  9. Nice blog right here! Additionally your web site rather
    a lot up very fast! What host are you using?
    Can I get your associate link to your host? I wish my web site
    loaded up as quickly as yours lol

  10. Hey exceptional blog! Does running a blog similar to this take a great deal of work?
    I’ve no understanding of computer programming however I was hoping to start
    my own blog soon. Anyways, should you have any recommendations
    or techniques for new blog owners please share.
    I understand this is off topic nevertheless I simply wanted to ask.
    Kudos!

  11. Hi there! I’m at work browsing your blog from my
    new apple iphone! Just wanted to say I love reading your blog and look forward to all your posts!

    Keep up the fantastic work!

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

  13. Pretty part of content. I just stumbled upon your site and
    in accession capital to claim that I get in fact enjoyed account your blog posts.

    Anyway I’ll be subscribing in your augment or even I success you get right
    of entry to consistently rapidly.

  14. This is the perfect web site for everyone who hopes to find out about this topic.

    You know so much its almost tough to argue with you (not
    that I personally would want to…HaHa). You definitely put a brand new
    spin on a topic that’s been discussed for a long time. Excellent stuff,
    just excellent!

  15. Heya just wanted to give you a quick 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.

  16. Today, I went to the beachfront with my kids.
    I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.”
    She put the shell to her ear and screamed. There was a hermit
    crab inside and it pinched her ear. She never wants to go back!
    LoL I know this is entirely off topic but I had to tell someone!

  17. When I initially commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get three
    emails with the same comment. Is there any way you can remove me from that service?
    Cheers!

  18. It’s a shame you don’t have a donate button! I’d without a doubt donate to this outstanding blog!
    I guess for now i’ll settle for book-marking and adding your RSS feed
    to my Google account. I look forward to new updates and will share this blog with my Facebook group.
    Chat soon!

  19. My family all the time say that I am killing
    my time here at net, however I know I am getting
    experience daily by reading thes good articles or reviews.

  20. I was curious if you ever considered changing the page layout of
    your blog? Its very well written; I love what youve got to
    say. But maybe you could a little more in the way of content so people could connect
    with it better. Youve got an awful lot of text for only having one or two pictures.
    Maybe you could space it out better?

  21. naturally like your web-site but you have to take a look at the spelling on several of your posts.
    Several of them are rife with spelling issues and I in finding it very troublesome to inform the reality nevertheless I will certainly come
    again again.

  22. Hi this is somewhat 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 know-how so I wanted to get
    advice from someone with experience. Any help would be enormously appreciated!

Comments are closed.