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 for … in.

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.

16,626 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku”

  1. Wow, incredible blog layout! How long have you been blogging for?
    you made blogging look easy. The overall look of your web site is excellent, as well as the content!

  2. I was curious if you ever considered changing the
    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 1 or 2 pictures.
    Maybe you could space it out better?

  3. I just like the helpful info you provide in your articles.

    I’ll bookmark your blog and check again here regularly.
    I’m slightly sure I will learn a lot of new stuff right right
    here! Good luck for the next!

  4. It’s a shame you don’t have a donate button! I’d 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.
    Chat soon!

  5. I delight in, lead to I discovered just what I was
    taking a look for. You have ended my four day lengthy hunt!
    God Bless you man. Have a nice day. Bye

  6. Купить вилочные штабелёры
    Обычно цена на погрузчик указана в его карточке в каталоге. Уточнить цену с доставкой к точному сроку можно отправив заявку прямо с сайта – мы действительно быстро отвечаем!
    Штабелёры вилочные, ричтраки https://shtabeler.blog/tipy-dvigatelej-shtabelera/
    место производства погрузчика;
    О том, для чего именно используются вилочные штабелёры и как самостоятельно выбрать качественный и надёжный погрузчик данного вида, будет подробно рассказано далее в статье.

    _____________________________________________
    ампириретиризм

  7. When some one searches for his required thing, so he/she desires to be available that in detail, so
    that thing is maintained over here.

  8. Howdy! Do you know if they make any plugins to protect against
    hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any tips?

  9. I’m not sure why but this weblog is loading incredibly slow
    for me. Is anyone else having this problem or is it a problem on my end?

    I’ll check back later on and see if the problem still exists.

  10. With havin so much content do you ever run into any problems of
    plagorism or copyright infringement? My blog has a lot of exclusive content I’ve either authored myself or outsourced but it appears a lot of it is popping it up all over the internet without my
    agreement. Do you know any methods to help prevent content from
    being ripped off? I’d certainly appreciate it.

  11. Howdy, i read your blog occasionally and i own a similar one and i was just wondering if you get a lot of spam comments?
    If so how do you prevent it, any plugin or anything you can suggest?

    I get so much lately it’s driving me mad so any
    help is very much appreciated.

  12. Amazing blog! Do you have any tips for aspiring writers?
    I’m planning to start my own site soon but I’m a little lost on everything.
    Would you recommend starting with a free platform like
    Wordpress or go for a paid option? There are so many options out there
    that I’m completely overwhelmed .. Any suggestions? Cheers!

  13. We’re a bunch of volunteers and starting a new scheme in our
    community. Your site provided us with valuable info to work on. You have performed a formidable activity and our whole community can be grateful to you.

  14. I’m amazed, I must say. Rarely do I encounter a blog that’s both equally educative
    and entertaining, and let me tell you, you have hit
    the nail on the head. The problem is something which too few folks are speaking intelligently about.
    I am very happy I found this in my search for something relating to this.

  15. Hmm is anyone else experiencing problems with the images on this blog loading?
    I’m trying to determine if its a problem on my end or if
    it’s the blog. Any responses would be greatly appreciated.

  16. What’s Happening i am new to this, I stumbled upon this I have found It absolutely useful and it has
    aided me out loads. I am hoping to contribute & help other customers like its helped me.
    Great job.

  17. I constantly emailed this web site post page to all my associates, for the
    reason that if like to read it afterward my contacts will too.

  18. Hello! This is my first visit to your blog! We are a team of volunteers and starting a new project in a community in the same niche.
    Your blog provided us beneficial information to work on. You
    have done a wonderful job!

  19. Hello! This is kind of off topic but I need some guidance from an established blog.
    Is it difficult to set up your own blog? I’m not very techincal but I can figure things out pretty fast.
    I’m thinking about making my own but I’m not sure where to start.
    Do you have any ideas or suggestions? Cheers

Comments are closed.