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. What’s Taking place i am new to this, I stumbled upon this I have discovered It positively
    useful and it has helped me out loads. I am hoping to
    contribute & help different users like its aided me.
    Good job.

  2. It’s a shame you don’t have a donate button! I’d without a
    doubt 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 brand new updates and will share
    this site with my Facebook group. Chat soon!

  3. Great beat ! I would like to apprentice while you amend your site, how can i subscribe for a blog site?
    The account aided me a acceptable deal. I had been a little bit acquainted of this your
    broadcast provided bright clear idea

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

  5. Hey there this is kind of 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 expertise so I wanted
    to get advice from someone with experience.
    Any help would be enormously appreciated!

  6. I believe this is among the such a lot vital information for me.
    And i’m happy reading your article. But wanna statement on few
    normal things, The site style is ideal, the articles is truly excellent : D.
    Excellent task, cheers

  7. Hi i am kavin, its my first time to commenting anyplace, when i read this paragraph i
    thought i could also create comment due to this sensible paragraph.

  8. Now I am going away to do my breakfast, later
    than having my breakfast coming over again to read additional news.

  9. Have you ever thought about adding a little bit
    more than just your articles? I mean, what you
    say is fundamental and all. But just imagine
    if you added some great pictures or video clips to give your posts more, “pop”!
    Your content is excellent but with images and video clips,
    this site could certainly be one of the best in its niche.
    Terrific blog!

  10. At this time it looks like Movable Type is the top blogging platform out there
    right now. (from what I’ve read) Is that what you are using on your blog?

  11. Your style is unique compared to other folks I’ve read stuff from.
    I appreciate you for posting when you have the opportunity,
    Guess I’ll just bookmark this site.

  12. It’s a shame you don’t have a donate button! I’d definitely
    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 brand new updates and will talk about this site with my Facebook
    group. Chat soon!

  13. I simply could not go away your site prior to suggesting that
    I actually enjoyed the standard information an individual provide for your visitors?
    Is gonna be back incessantly to check out new posts

  14. Hi my loved one! I wish to say that this article is amazing, nice written and
    come with almost all vital infos. I would like to look extra posts like
    this .

  15. Attractive section of content. I just stumbled upon your site and in accession capital to assert that I get in fact enjoyed account your blog posts.

    Anyway I’ll be subscribing to your augment and even I achievement you access consistently fast.

  16. Hi there! Someone in my Myspace group shared this site with us so I came
    to take a look. I’m definitely loving the information. I’m
    bookmarking and will be tweeting this to my followers!
    Outstanding blog and outstanding style and design.

  17. Hi! Do you know if they make any plugins to assist with SEO?
    I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good success.
    If you know of any please share. Appreciate it!

  18. I do not know whether it’s just me or if perhaps everybody else encountering
    problems with your blog. It appears like some of the text on your content
    are running off the screen. Can someone else please comment and let me
    know if this is happening to them as well? This might be a problem with my browser because
    I’ve had this happen before. Cheers

  19. I have been surfing online greater than 3
    hours these days, yet I by no means found any fascinating article like yours.
    It’s lovely worth sufficient for me. In my opinion, if all webmasters and bloggers made just right content material
    as you did, the net can be much more helpful than ever before.

  20. Hey there! I’ve been reading your blog for a long time now and finally got the courage to go ahead
    and give you a shout out from Austin Tx! Just wanted to say keep up the excellent
    work!

Comments are closed.