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.

48,210 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. Howdy are using WordPress for your site platform?
    I’m new to the blog world but I’m trying to get started
    and create my own. Do you need any html coding expertise to make your own blog?

    Any help would be really appreciated!

  2. I was curious if you ever considered changing the structure of your website?
    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 images.
    Maybe you could space it out better?

  3. I think that everything published made a bunch of sense.
    But, think about this, what if you added a little information? I
    mean, I don’t wish to tell you how to run your blog,
    however suppose you added a post title to maybe grab people’s attention? I mean Contoh Soal Pemrograman – Pola Segitiga Siku-siku –
    Umar faisol is kinda vanilla. You ought to peek at Yahoo’s home page and watch how they create news titles to
    get viewers interested. You might add a related video or a
    pic or two to get readers excited about everything’ve got to say.
    In my opinion, it might make your blog a little bit more interesting.

  4. Good day! 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 outstanding job!

  5. Hello there, just became aware of your blog through Google, and found that it is truly informative.
    I am going to watch out for brussels. I will appreciate if you continue this {in future}.
    Many people will be benefited from your writing.
    Cheers!

  6. Today, I went to the beach with my children. 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 put 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 totally off
    topic but I had to tell someone!

  7. When someone writes an post he/she retains the thought of a user in his/her brain that how
    a user can be aware of it. Therefore that’s why this paragraph is outstdanding.

    Thanks!

  8. Appreciating the time and energy 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 information.
    Excellent read! I’ve saved your site and I’m adding
    your RSS feeds to my Google account.

  9. Howdy! I know this is kinda off topic but I was wondering which blog platform are you using for
    this site? I’m getting tired of WordPress because I’ve had problems with
    hackers and I’m looking at alternatives for another platform.
    I would be great if you could point me in the direction of
    a good platform.

  10. Hi, I do believe this is an excellent blog. I stumbledupon it 😉 I am going to come back once again since I saved as a favorite it.
    Money and freedom is the best way to change, may you be rich and continue to help other people.

  11. I’m not certain where you’re getting your info, but good topic.
    I must spend some time learning more or working out more.
    Thank you for wonderful info I was on the lookout for this info for my mission.

  12. My brother recommended I might like this blog. He was entirely
    right. This post truly made my day. You cann’t imagine simply how much time I had spent for
    this information! Thanks!

  13. It’s actually a great and useful piece of information. I am glad that you simply shared this helpful info with us.

    Please keep us informed like this. Thank you for sharing.

  14. We are a bunch of volunteers and opening a new scheme in our community.
    Your site provided us with helpful info to work on. You’ve
    done an impressive job and our whole group
    will be grateful to you.

  15. Hey very cool site!! Man .. Excellent .. Amazing ..
    I’ll bookmark your web site and take the feeds also?
    I’m satisfied to search out so many useful information here within the submit, we’d like work out more techniques on this regard,
    thank you for sharing. . . . . .

  16. Aw, this was a very nice post. Taking the time and
    actual effort to make a top notch article… but
    what can I say… I hesitate a lot and never manage to get anything
    done.

  17. Hi! Someone in my Myspace group shared this site with
    us so I came to check it out. I’m definitely enjoying the information. I’m
    bookmarking and will be tweeting this to my followers!
    Excellent blog and superb design.

  18. Greate pieces. Keep writing such kind of information on your page.
    Im really impressed by your site.
    Hey there, You’ve done an incredible job. I’ll definitely digg it and for my part recommend to my friends.
    I’m sure they will be benefited from this website.

  19. Hey would you mind letting me know which webhost you’re using?
    I’ve loaded your blog in 3 completely different web browsers and I must say this blog
    loads a lot quicker then most. Can you suggest a good hosting provider at
    a reasonable price? Thanks, I appreciate it!

  20. My spouse and I stumbled over here coming from a different web address and thought I should check things
    out. I like what I see so now i’m following you. Look forward to looking over your web
    page yet again.

  21. Greetings! I know this is kinda off topic but I’d figured I’d ask.
    Would you be interested in trading links or maybe guest
    writing a blog post or vice-versa? My blog goes over a
    lot of the same topics as yours and I think we could greatly
    benefit from each other. If you happen to be interested feel free to send me an email.
    I look forward to hearing from you! Terrific blog by the way!

  22. Hello there! Quick question that’s totally off topic.
    Do you know how to make your site mobile friendly?
    My web site looks weird when browsing from my iphone 4. I’m trying to find a theme or
    plugin that might be able to correct this issue. If you have any recommendations, please share.
    Thanks!

Comments are closed.