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. Pretty section of content. I simply stumbled upon your site and in accession capital to claim that I acquire actually enjoyed account your blog posts.
    Any way I’ll be subscribing for your augment and
    even I achievement you get right of entry to persistently
    fast.

  2. Aw, this was a very nice post. Taking a few minutes and actual effort to create a superb article… but
    what can I say… I procrastinate a lot
    and never manage to get anything done.

  3. I loved as much as you will receive carried out right here.
    The sketch is tasteful, your authored subject matter stylish.
    nonetheless, you command get bought an nervousness over that you
    wish be delivering the following. unwell unquestionably come further formerly again as exactly the same nearly very often inside case you shield
    this increase.

  4. excellent points altogether, you simply won a brand new reader.

    What would you suggest in regards to your publish that you simply made
    a few days ago? Any certain?

  5. Hi, this weekend is pleasant in support of me, because this moment i am reading this enormous educational article
    here at my residence.

  6. It’s a pity you don’t have a donate button! I’d without a doubt donate to this superb blog!
    I guess for now i’ll settle for bookmarking
    and adding your RSS feed to my Google account.

    I look forward to fresh updates and will talk about this blog with my Facebook group.

    Talk soon!

  7. If some one desires expert view on the topic of running a blog after that i
    recommend him/her to pay a visit this weblog, Keep up the pleasant work.

  8. Wow that was strange. I just wrote an very long comment
    but after I clicked submit my comment didn’t show up.
    Grrrr… well I’m not writing all that over again. Regardless, just wanted
    to say wonderful blog!

  9. I don’t even know how I finished up right here, but I thought this submit
    was once good. I don’t know who you might be however certainly you are going to a well-known blogger for those who are not already.
    Cheers!

  10. Yesterday, while I was at work, my sister stole my apple ipad and tested to see if it can survive a twenty five 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 completely off topic but I had to share it with someone!

  11. You should be a part of a contest for one of the greatest sites on the web.
    I’m going to highly recommend this blog!

  12. Have you ever considered about including a little bit more than just your
    articles? I mean, what you say is important
    and everything. Nevertheless think about if you added some great
    visuals or videos to give your posts more, “pop”! Your content is excellent but with images and videos, this blog could certainly be one of the most beneficial in its
    niche. Terrific blog!

  13. It’s a pity you don’t have a donate button! I’d most certainly donate to this superb
    blog! I suppose for now i’ll settle for book-marking and
    adding your RSS feed to my Google account.
    I look forward to fresh updates and will talk
    about this blog with my Facebook group. Chat soon!

  14. Does your blog 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 site and I look forward to seeing it improve over time.

  15. Hey 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 skills so I wanted to get guidance from
    someone with experience. Any help would be greatly appreciated!

  16. Link exchange is nothing else however it is just placing the other person’s blog
    link on your page at appropriate place and other person will also do similar for you.

  17. Fantastic beat ! I would like to apprentice even as you amend your
    site, how can i subscribe for a weblog site? The account helped me a acceptable deal.
    I had been a little bit familiar of this your broadcast provided brilliant clear idea

Comments are closed.