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 very cool site!! Man .. Beautiful ..
    Superb .. I will bookmark your site and take the feeds also?
    I’m happy to seek out so many useful info here within the put up,
    we need work out extra techniques on this regard, thank you for sharing.
    . . . . .

  2. Oh my goodness! Impressive article dude! Many thanks, However
    I am having difficulties with your RSS. I don’t understand why I can’t join it.
    Is there anyone else getting identical RSS issues?
    Anyone that knows the solution can you kindly respond? Thanks!!

  3. Have you ever thought about publishing an e-book or guest authoring
    on other sites? I have a blog based on the same
    topics you discuss and would love to have you share some stories/information. I know my readers would appreciate your work.
    If you’re even remotely interested, feel free to send me an email.

  4. hello there and thank you for your info – I have certainly picked up something new from right
    here. I did however expertise a few technical issues using this website, as I experienced
    to reload the site lots of times previous to I could get it
    to load properly. I had been wondering if your hosting is OK?

    Not that I’m complaining, but sluggish loading instances times will
    often affect your placement in google and can damage your high-quality score if ads and marketing with Adwords.
    Well I am adding this RSS to my email and could look out for much more of your respective interesting content.

    Make sure you update this again soon.

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

  6. Nice post. I was checking constantly this blog and I’m impressed!

    Extremely useful info particularly the last part :
    ) I care for such info a lot. I was looking for this particular
    information for a long time. Thank you and best of luck.

  7. I was suggested this web site by my cousin. I am
    not sure whether this post is written by him as no one else know such detailed
    about my difficulty. You’re wonderful! Thanks!

  8. Appreciating the commitment you put into your
    website and detailed information you provide. It’s good
    to come across a blog every once in a while that isn’t the same out of date rehashed information. Excellent read!
    I’ve saved your site and I’m including your RSS feeds to my Google account.

  9. Hi there very nice site!! Man .. Excellent .. Superb ..
    I’ll bookmark your blog and take the feeds also?
    I’m happy to seek out a lot of useful information here within the post, we’d like work out
    more strategies on this regard, thank you for sharing.
    . . . . .

  10. Hey! I know this is kinda off topic however , I’d figured I’d ask.
    Would you be interested in trading links or maybe guest writing a blog article
    or vice-versa? My site goes over a lot of the same subjects as yours
    and I believe we could greatly benefit from each other. If you happen to be interested feel free
    to shoot me an e-mail. I look forward to hearing
    from you! Excellent blog by the way!

  11. Good day! Do you know if they make any plugins to help with Search Engine Optimization? 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. Thanks!

  12. Hi every one, here every person is sharing such know-how, therefore it’s nice to read this
    website, and I used to go to see this web site daily.

  13. I blog often and I genuinely appreciate your information. The article has truly peaked
    my interest. I’m going to take a note of your website and keep checking for new information about
    once a week. I opted in for your RSS feed as well.

  14. Have you ever considered about including a little bit more than just your articles?
    I mean, what you say is fundamental and everything.

    However think about if you added some great pictures or video clips
    to give your posts more, “pop”! Your content is excellent but with
    pics and videos, this website could undeniably be one of the greatest in its niche.
    Superb blog!

  15. obviously like your website but you need to test the spelling on several of your posts.
    A number of them are rife with spelling problems and I to find it
    very troublesome to inform the truth then again I’ll definitely come back again.

  16. I do not know if it’s just me or if everyone else experiencing problems with your website.

    It appears as though some of the written text on your posts are running off the screen. Can someone else please provide feedback and let me know
    if this is happening to them too? This might be a problem with
    my internet browser because I’ve had this happen before.
    Cheers

  17. Fantastic blog! Do you have any tips and hints for aspiring writers?
    I’m hoping to start my own site 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 recommendations? Appreciate it!

  18. I’ll right away snatch your rss as I can not to find your email subscription link or e-newsletter service.
    Do you’ve any? Kindly permit me recognize in order that I may
    subscribe. Thanks.

  19. With havin so much written content do you ever
    run into any issues of plagorism or copyright infringement?
    My blog has a lot of unique content I’ve either created myself or outsourced but it appears a lot of it is popping it
    up all over the internet without my permission. Do you know any methods
    to help protect against content from being
    stolen? I’d certainly appreciate it.

  20. Hey there! I’ve been reading your site for some time now and finally got the courage to go ahead and give
    you a shout out from Lubbock Texas! Just wanted to mention keep up
    the fantastic work!

  21. you’re truly a excellent webmaster. The website loading velocity is amazing.
    It kind of feels that you are doing any unique trick.
    Furthermore, The contents are masterwork.
    you’ve performed a magnificent activity on this subject!

  22. It is appropriate time to make a few plans for the future
    and it’s time to be happy. I’ve read this put up and if I may I want to recommend you some attention-grabbing things or advice.
    Perhaps you could write subsequent articles referring to this
    article. I wish to read more things approximately it!

  23. Hi, I believe your website may be having web browser compatibility problems.
    Whenever I take a look at your web site in Safari, it looks fine however
    when opening in IE, it’s got some overlapping issues. I merely wanted
    to give you a quick heads up! Aside from that, wonderful website!

Comments are closed.