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. I have fun with, cause I discovered exactly what I used to be
    taking a look for. You have ended my four day lengthy hunt!
    God Bless you man. Have a great day. Bye

  2. I’m impressed, I must say. Seldom do I come across a blog that’s both educative and amusing, and let
    me tell you, you have hit the nail on the head.

    The problem is something not enough men and women are speaking intelligently about.

    Now i’m very happy that I stumbled across this in my search for something regarding this.

  3. I’m curious to find out what blog platform you are
    utilizing? I’m having some small security issues with my latest blog and I would like to find something more safe.
    Do you have any solutions?

  4. I believe what you composed was very reasonable.

    However, think on this, what if you composed a catchier post title?

    I am not suggesting your content isn’t good., but what if you added something
    to maybe get people’s attention? I mean Contoh Soal Pemrograman – Pola Segitiga Siku-siku
    – Umar faisol is a little boring. You should
    look at Yahoo’s home page and see how they create article titles to grab
    viewers interested. You might try adding 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.

  5. Good day! I could have sworn I’ve been to this blog before but after browsing through some of
    the post I realized it’s new to me. Nonetheless, I’m definitely glad I found
    it and I’ll be bookmarking and checking back often!

  6. I like the helpful info you provide in your articles. I will
    bookmark your weblog and check again here frequently.
    I am quite sure I’ll learn many new stuff right here!
    Good luck for the next!

  7. Hi there terrific blog! Does running a blog similar to this require a large amount of work?

    I have very little knowledge of programming however I
    was hoping to start my own blog soon. Anyway, if you have
    any suggestions or tips for new blog owners please share. I understand this is off topic nevertheless I simply wanted to ask.

    Cheers!

  8. What’s Happening i’m new to this, I stumbled upon this I have discovered It positively useful
    and it has helped me out loads. I’m hoping to give
    a contribution & help other customers like its helped me.
    Great job.

  9. Superb blog! Do you have any helpful hints for aspiring writers?
    I’m planning to start my own blog soon but I’m a little lost on everything.
    Would you propose starting with a free platform like
    Wordpress or go for a paid option? There are so many choices out there that I’m totally
    confused .. Any ideas? Cheers!

    Take a look at my site – https://slotpulsa188.xyz

  10. I loved as much as you’ll receive carried out right here.

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

  11. You can definitely see your enthusiasm within the work you write.
    The sector hopes for even more passionate writers like you who are not afraid to mention how they believe.

    All the time go after your heart.

  12. I’m extremely impressed with your writing skills and also with the layout on your blog.
    Is this a paid theme or did you modify it
    yourself? Anyway keep up the nice quality writing, it is rare to see a nice blog like this one today.

  13. Appreciating the time and effort you put into your blog and in depth information you offer.
    It’s great to come across a blog every once in a while that isn’t the same unwanted rehashed material.
    Fantastic read! I’ve bookmarked your site and I’m including your RSS feeds
    to my Google account.

  14. Hello i am kavin, its my first time to commenting anyplace, when i read this paragraph i
    thought i could also make comment due to this sensible post.

  15. Wow that was strange. I just wrote an incredibly long comment but after I
    clicked submit my comment didn’t appear. Grrrr…
    well I’m not writing all that over again. Anyways, just wanted to say superb blog!

  16. I feel this is among the most significant information for me.
    And i’m happy reading your article. However want to commentary on some basic
    issues, The web site style is wonderful,
    the articles is in reality nice : D. Good job, cheers

  17. Everyone loves what you guys are up too. This type of clever work and exposure!
    Keep up the amazing works guys I’ve added you guys to my own blogroll.

  18. I truly love your blog.. Very nice colors & theme. Did you build this site yourself?
    Please reply back as I’m attempting to create my own blog and would love to learn where you got
    this from or just what the theme is called.
    Appreciate it!

  19. An intriguing discussion is worth comment. I do think that
    you should write more on this subject, it may not be a taboo matter but typically people don’t discuss such issues.
    To the next! Kind regards!!

Comments are closed.