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. What i do not realize is if truth be told how you’re not actually a lot more smartly-preferred than you may be right now.
    You are very intelligent. You already know therefore considerably in terms of this topic, produced me for
    my part imagine it from so many numerous angles. Its like women and men aren’t
    interested until it’s something to accomplish with Girl gaga!
    Your own stuffs outstanding. At all times handle it up!

  2. Hi there! This is my first visit to your blog! We are a collection 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 extraordinary job!

  3. Its like you read my mind! You seem to know a lot about this, like you wrote the book in it or something.
    I think that you can do with some pics to drive the message home a bit, but other
    than that, this is excellent blog. A fantastic read.
    I will certainly be back.

  4. I just like the valuable information you supply on your articles.

    I will bookmark your weblog and test once more here frequently.
    I’m relatively sure I will learn plenty of new stuff proper
    right here! Good luck for the next!

  5. I was wondering 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 one or two images.
    Maybe you could space it out better?

  6. I’m impressed, I must say. Rarely do I come across a blog that’s both equally educative and amusing,
    and let me tell you, you’ve hit the nail on the head. The problem is something that too few folks are speaking intelligently about.
    I am very happy I found this in my search for something regarding this.

  7. Hey there! This is my first visit to your blog! We are
    a team of volunteers and starting a new initiative in a community in the same niche.

    Your blog provided us beneficial information to work on. You have done a marvellous
    job!

  8. After I originally commented I seem to have clicked the -Notify me when new comments are added- checkbox and from now on every time a comment
    is added I recieve 4 emails with the same comment.
    Perhaps there is a way you are able to remove me from that service?
    Appreciate it!

  9. We stumbled over here coming from a different page and thought I may as well check things out.
    I like what I see so now i’m following you. Look forward to exploring your web page for a second time.

  10. I’m impressed, I must say. Rarely do I encounter a blog that’s both educative
    and entertaining, and without a doubt, you’ve hit the nail
    on the head. The problem is something too few people are speaking intelligently about.
    Now i’m very happy I came across this during my search
    for something concerning this.

  11. I think everything posted was actually very reasonable.
    However, consider this, suppose you were to write a killer title?
    I am not saying your information isn’t solid, however suppose you added something to possibly
    get people’s attention? I mean Contoh Soal Pemrograman – Pola Segitiga
    Siku-siku – Umar faisol is a little plain. You should glance at Yahoo’s home page and watch how they create
    news headlines to grab viewers to open the links.

    You might try adding a video or a related picture or two to grab readers excited
    about what you’ve got to say. In my opinion, it could bring your blog a little livelier.

  12. Right now it looks like Movable Type is the top blogging
    platform out there right now. (from what I’ve read) Is that what you are using on your blog?

  13. Hey there! I’ve been reading your blog for some time now and finally got the
    bravery to go ahead and give you a shout out from Huffman Texas!
    Just wanted to mention keep up the excellent job!

  14. Good day! Do you know if they make any plugins to assist
    with SEO? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing
    very good results. If you know of any please share.

    Cheers!

  15. Hi, i think that i saw you visited my weblog so i got here to return the want?.I’m
    trying to in finding issues to enhance my site!I assume its ok to use some of your concepts!!

  16. Useful information. Fortunate me I found your web site by accident, and I
    am surprised why this accident did not happened in advance!
    I bookmarked it.

  17. Wow, incredible weblog structure! How lengthy have you been blogging
    for? you made blogging look easy. The whole glance of your site is great, let alone
    the content!

  18. obviously like your web site but you have to test the spelling on quite a few
    of your posts. A number of them are rife with spelling problems
    and I find it very bothersome to tell the truth then again I’ll definitely come again again.

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

  20. I’m gone to say to my little brother, that he should also go to see this weblog on regular basis to take updated from newest information.

  21. Hey! I just wanted to ask if you ever have any problems with hackers?

    My last blog (wordpress) was hacked and I ended up losing
    months of hard work due to no backup. Do you have any solutions to stop hackers?

Comments are closed.