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. I believe what you published was very reasonable. But,
    think about this, suppose you were to create a killer post
    title? I am not suggesting your information isn’t good., however
    what if you added a title to maybe grab folk’s attention? I mean Contoh Soal Pemrograman – Pola Segitiga Siku-siku – Umar faisol is kinda boring.

    You might look at Yahoo’s home page and watch how they write article
    headlines to get viewers to open the links. You might add a video or a related pic or two to grab people excited about everything’ve got to say.

    In my opinion, it could make your posts a little bit more interesting.

  2. Greetings from Ohio! I’m bored to death at work so I decided
    to check out your site on my iphone during lunch break.
    I love the info you provide here and can’t wait
    to take a look when I get home. I’m shocked at how fast your blog loaded on my phone ..

    I’m not even using WIFI, just 3G .. Anyhow, great site!

  3. It’s a pity you don’t have a donate button! I’d definitely donate to this superb 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 site
    with my Facebook group. Talk soon!

  4. If some one desires expert view on the topic of blogging and site-building then i propose him/her to go to see this blog, Keep
    up the fastidious job.

  5. Admiring the persistence you put into your blog and
    in depth information you provide. It’s good to come across a blog every
    once in a while that isn’t the same unwanted rehashed information. Wonderful read!

    I’ve bookmarked your site and I’m adding your RSS feeds to my Google account.

  6. Hello friends, how is the whole thing, and what you
    desire to say about this paragraph, in my view its in fact amazing
    designed for me.

  7. whoah this weblog is great i like reading your
    posts. Keep up the good work! You know, many persons are
    hunting around for this info, you could help them greatly.

  8. Hmm it appears like your site ate my first comment (it was
    super long) so I guess I’ll just sum it up what I submitted
    and say, I’m thoroughly enjoying your blog. I too am an aspiring blog
    blogger but I’m still new to everything. Do you have any tips and hints for newbie blog writers?
    I’d definitely appreciate it.

  9. A person necessarily assist to make seriously articles I might state.
    That is the first time I frequented your web page and to
    this point? I amazed with the analysis you made to make this particular submit extraordinary.

    Fantastic process!

  10. Hey! I just wanted to ask if you ever have any
    issues 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 protect against hackers?

  11. I have been surfing on-line more than three hours nowadays,
    but I never found any attention-grabbing article
    like yours. It’s beautiful price sufficient for me. In my view,
    if all web owners and bloggers made good content material as you probably did,
    the net can be much more helpful than ever before.

  12. Currently it appears like Expression Engine is the preferred blogging platform available right now.

    (from what I’ve read) Is that what you are using on your blog?

  13. Wow, fantastic blog structure! How lengthy have you
    been running a blog for? you make blogging look easy.
    The whole glance of your web site is excellent, as neatly as the content!

  14. Hey! This is my first visit to your blog! We are a
    group of volunteers and starting a new project in a community in the
    same niche. Your blog provided us useful information to work on. You
    have done a marvellous job!

  15. Pretty section of content. I simply stumbled
    upon your blog and in accession capital to assert
    that I get in fact enjoyed account your blog posts.
    Anyway I will be subscribing in your augment or even I
    fulfillment you get admission to persistently rapidly.

  16. Post writing is also a fun, if you be acquainted with after that you can write
    if not it is complicated to write.

  17. constantly i used to read smaller content that as
    well clear their motive, and that is also happening with this piece of writing which I am reading
    here.

  18. It’s a shame you don’t have a donate button! I’d most certainly donate to this fantastic 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 talk about this site with my Facebook
    group. Talk soon!

  19. It’s truly very complex in this active life to listen news on Television, therefore I only use world wide web for that purpose, and take the latest news.

  20. It’s going to be ending of mine day, except before ending
    I am reading this impressive article to increase my experience.

Comments are closed.