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. Today, I went to the beachfront with my kids. I found a sea shell and gave it to my 4 year
    old daughter and said “You can hear the ocean if you put this to your ear.” She placed the shell
    to her ear and screamed. There was a hermit crab inside and it pinched her ear.
    She never wants to go back! LoL I know this is completely off
    topic but I had to tell someone!

  2. Howdy! I simply wish to give you a big thumbs up for your excellent information you have right here on this post.
    I am returning to your blog for more soon.

  3. Fantastic blog! Do you have any tips and hints for
    aspiring writers? I’m hoping to start my own blog 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 choices out there that I’m totally overwhelmed ..
    Any recommendations? Appreciate it!

  4. Excellent blog here! Also your web site loads up very fast!
    What web host are you using? Can I get your affiliate
    link to your host? I wish my web site loaded up as quickly as yours lol

  5. I loved as much as you will receive carried out right here.

    The sketch is attractive, your authored material stylish.
    nonetheless, you command get bought an shakiness over that you
    wish be delivering the following. unwell unquestionably
    come more formerly again as exactly the same nearly a lot often inside case you shield this increase.

  6. I don’t know whether it’s just me or if everybody else encountering issues with your
    site. It appears as if some of the written text on your posts are running
    off the screen. Can somebody else please comment and let me
    know if this is happening to them too? This might be a issue
    with my web browser because I’ve had this happen before.
    Kudos

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

  8. Wow, amazing blog layout! How lengthy have you ever been blogging for?
    you made blogging glance easy. The total look of your web site is magnificent, let alone the content!

  9. 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.
    Any way I will be subscribing to your augment and even I
    achievement you access consistently rapidly.

  10. I pay a quick visit every day a few web sites and information sites to read content, but this blog provides feature
    based writing.

  11. Hi, I do believe this is a great site. I stumbledupon it 😉 I am
    going to come back yet again since i have bookmarked
    it. Money and freedom is the best way to change, may you be rich and
    continue to help other people.

  12. excellent issues altogether, you just gained a logo new reader.

    What could you recommend in regards to your put up that you made a few days ago?

    Any positive?

  13. After I originally left a comment I appear to have clicked
    the -Notify me when new comments are added- checkbox
    and now each time a comment is added I recieve 4 emails with the exact same comment.
    Is there a way you can remove me from that service? Appreciate
    it!

  14. I’ve been surfing online more than three hours today,
    yet I never found any interesting article like yours.
    It’s pretty worth enough for me. In my opinion, if all webmasters and bloggers made
    good content as you did, the internet will be much more useful than ever before.

  15. I do not even understand how I stopped up here, but I thought this publish was great.
    I don’t understand who you are but certainly you are going
    to a famous blogger if you are not already. Cheers!

  16. Hi all, here every person is sharing these kinds of experience, therefore it’s good to read this blog, and I used
    to pay a quick visit this web site daily.

  17. Hello, i feel that i noticed you visited my blog thus i came to go
    back the prefer?.I am trying to in finding issues to improve my site!I guess its good enough to use a few of your ideas!!

  18. Hi, constantly i used to check webpage posts here in the early hours in the daylight, since i like to learn more
    and more.

  19. Good day! Do you know if they make any plugins
    to help 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!

  20. For most up-to-date information you have to pay a visit web and on world-wide-web I found this web page as
    a best site for newest updates.

  21. No matter if some one searches for his necessary thing, therefore
    he/she needs to be available that in detail, therefore that thing is maintained
    over here.

Comments are closed.