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,215 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. Hiya! Quick question that’s entirely off topic.
    Do you know how to make your site mobile friendly? My site looks weird when browsing from my iphone.
    I’m trying to find a theme or plugin that might be able
    to resolve this problem. If you have any suggestions,
    please share. Many thanks!

  2. I like the valuable info you provide on your articles. I will
    bookmark your blog and check again here regularly. I am somewhat sure I will be told many
    new stuff proper right here! Best of luck for the next!

  3. I am curious to find out what blog platform you happen to be using?
    I’m having some small security issues with my latest site and
    I’d like to find something more risk-free. Do you
    have any recommendations?

  4. I am not sure where you’re getting your information, but
    great topic. I needs to spend some time learning much more or understanding more.
    Thanks for great information I was looking for this info for my mission.

  5. Usually I do not learn article on blogs, however I
    wish to say that this write-up very forced me to check out and do
    it! Your writing style has been surprised me. Thanks, quite
    nice article.

  6. Do you mind if I quote a few of your posts as long as
    I provide credit and sources back to your blog? My blog site
    is in the very same niche as yours and my
    users would definitely benefit from some of the information you provide here.

    Please let me know if this okay with you. Thanks a lot!

  7. I’m not positive the place you’re getting your information, however good topic.
    I must spend a while learning more or figuring out more.
    Thanks for fantastic info I used to be in search of this info for my mission.

  8. I’m truly enjoying the design and layout of your site. It’s a very easy on the eyes which
    makes it much more enjoyable for me to come here and visit more often. Did you hire out a developer to create your theme?
    Exceptional work!

  9. We stumbled over here different page and thought I might as
    well check things out. I like what I see so now i’m following you.
    Look forward to looking at your web page repeatedly.

  10. I loved as much as you will receive carried out right here.
    The sketch is tasteful, your authored material stylish.
    nonetheless, you command get got an nervousness over that you
    wish be delivering the following. unwell unquestionably come
    further formerly again as exactly the same nearly very often inside case you shield this increase.

  11. Great weblog right here! Also your website rather a lot up very fast!
    What host are you using? Can I get your associate link in your host?
    I wish my site loaded up as quickly as yours lol

  12. I’m truly enjoying the design and layout of your blog.
    It’s a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you
    hire out a designer to create your theme?
    Superb work!

  13. Awesome things here. I’m very glad to look your post. Thank you a lot and I’m taking a look forward to contact
    you. Will you kindly drop me a mail?

  14. Thanks , I have just been looking for information approximately this subject for ages and
    yours is the greatest I have came upon till now. But, what concerning the conclusion? Are you
    certain about the source?

  15. I am really loving the theme/design of your blog. Do you
    ever run into any web browser compatibility problems? A couple of
    my blog visitors have complained about my site not operating correctly in Explorer but
    looks great in Safari. Do you have any advice to help fix this
    issue?

  16. I do accept as true with all the concepts you have offered to your post.
    They’re really convincing and can definitely work. Still,
    the posts are very quick for novices. May just you
    please extend them a little from next time?
    Thank you for the post.

  17. Heya! I know this is sort of off-topic however I had to ask.
    Does operating a well-established website like yours take a massive amount work?

    I’m brand new to operating a blog but I do write
    in my diary everyday. I’d like to start a blog so
    I can share my own experience and thoughts online. Please let me know if you have any suggestions or tips for new aspiring
    bloggers. Appreciate it!

  18. 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 entirely off topic but I had to tell someone!

  19. important review. In addition visit often the site to
    try out slot pulsa online. This amazing site has received popularity via slot
    online video gaming cricket fans in Dalam negeri. At this time there are actually a great deal
    of intriguing promos when you join right now.

  20. Very nice post. I just stumbled upon your blog and wished to say that I have truly enjoyed surfing around your blog posts.

    In any case I’ll be subscribing to your feed and
    I hope you write again very soon!

  21. Hey there just wanted to give you a quick heads up.
    The text in your content seem to be running off the screen in Opera.

    I’m not sure if this is a format issue or something to do with web browser compatibility but I thought I’d
    post to let you know. The design and style look great though!
    Hope you get the problem resolved soon. Kudos

  22. When I initially commented I clicked the “Notify me when new comments are added” checkbox
    and now each time a comment is added I get three emails with
    the same comment. Is there any way you can remove me from that service?
    Bless you!

  23. Hi there! I could have sworn I’ve visited this blog before but after browsing through
    many of the articles I realized it’s new to me. Anyhow, I’m definitely delighted I
    stumbled upon it and I’ll be bookmarking it and checking back frequently!

  24. After looking into a handful of the blog posts on your site,
    I seriously like your way of writing a blog.
    I saved it to my bookmark website list and will be
    checking back soon. Please check out my website too and tell me your opinion.

  25. Does your site have a contact page? I’m having problems locating it but, I’d like
    to shoot you an email. I’ve got some creative ideas for your blog you might be interested in hearing.

    Either way, great website and I look forward to seeing it
    improve over time.

  26. Good day I am so glad I found your webpage, I really found you by error,
    while I was looking on Aol for something else, Regardless I am here now and would just like
    to say thank you for a fantastic post and a all round entertaining blog (I also love the theme/design), I don’t have time to look over
    it all at the moment but I have bookmarked it and also added your RSS feeds, so when I have time I will be back to read a lot
    more, Please do keep up the superb jo.

Comments are closed.