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. Hello it’s me, I am also visiting this site daily, this web
    site is in fact fastidious and the people are actually sharing fastidious thoughts.

  2. Wow, incredible blog layout! How long have you been blogging for?
    you made blogging look easy. The overall look of your web site is great, let alone
    the content!

  3. Magnificent beat ! I wish to apprentice even as you amend your web site, how could i subscribe for a weblog
    web site? The account helped me a acceptable deal.

    I had been a little bit familiar of this your broadcast offered vibrant transparent idea

  4. I think that everything said was actually very reasonable.
    However, consider this, what if you typed a catchier post title?

    I am not saying your information is not solid, however suppose you added something that grabbed a
    person’s attention? I mean Contoh Soal Pemrograman – Pola Segitiga
    Siku-siku – Umar faisol is a little boring.
    You should look at Yahoo’s front page and see how they write news headlines to get people interested.
    You might add a video or a related pic or two to get people excited about what you’ve written. Just my
    opinion, it would bring your posts a little livelier.

  5. continuously i used to read smaller posts that also clear their motive,
    and that is also happening with this article which
    I am reading at this place.

  6. you’re truly a excellent webmaster. The web site loading pace is amazing.
    It seems that you’re doing any unique trick. In addition, The contents are masterwork.
    you have performed a magnificent task in this subject!

  7. Whoa! This blog looks exactly like my old one!
    It’s on a totally different topic but it has pretty
    much the same layout and design. Excellent choice of colors!

  8. Truly when someone doesn’t know afterward its up to other visitors that they will help, so here it
    occurs.

  9. I was curious if you ever thought of changing the page layout of your site?
    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 2 pictures. Maybe you could space it out better?

  10. I’m not sure exactly why but this blog is loading very slow for me.
    Is anyone else having this issue or is it a problem on my end?
    I’ll check back later and see if the problem still exists.

  11. Valuable information. Fortunate me I discovered your site unintentionally, and I am stunned why this coincidence didn’t happened earlier!
    I bookmarked it.

  12. Hello everyone, it’s my first go to see at this
    web page, and piece of writing is truly fruitful in support of me,
    keep up posting such articles or reviews.

  13. Hi to all, how is all, I think every one is getting more from this web page, and your views are
    nice in favor of new visitors.

  14. Howdy! I’m at work browsing your blog from my new apple
    iphone! Just wanted to say I love reading through your blog and
    look forward to all your posts! Carry on the great work!

  15. Hi are using WordPress for your blog platform?
    I’m new to the blog world but I’m trying to get started and set up my own. Do you need any coding knowledge to make your own blog?

    Any help would be greatly appreciated!

  16. That is a very good tip especially to those fresh to the blogosphere.
    Simple but very precise information… Appreciate your sharing
    this one. A must read article!

  17. I like the helpful info you provide in your articles. I will bookmark your blog and check again here frequently.
    I am quite sure I’ll learn lots of new stuff right here!

    Best of luck for the next!

  18. I like the helpful information you provide in your articles.
    I’ll bookmark your weblog and check again here regularly.
    I am quite sure I’ll learn lots of new stuff right here! Best of
    luck for the next!

Comments are closed.