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. Hi there, I found your web site via Google at
    the same time as searching for a similar topic, your web site got here up, it appears to
    be like good. I’ve bookmarked it in my google bookmarks.

    Hi there, simply became aware of your weblog thru Google, and located that it is truly informative.
    I am gonna be careful for brussels. I will be grateful in case you proceed this {in future}.

    Numerous other folks will be benefited out of your
    writing. Cheers!

  2. Hi 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’ll appreciate if you continue
    this {in future}. Numerous people will be benefited from your writing.
    Cheers!

  3. you’re actually a just right webmaster. The web site loading
    speed is incredible. It seems that you are doing any unique trick.

    In addition, The contents are masterpiece. you’ve performed a
    magnificent job in this subject!

  4. 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?
    Cheers!

  5. Thank you, I’ve recently been looking for information about
    this topic for a while and yours is the greatest I have discovered till now.
    But, what about the bottom line? Are you positive in regards to the source?

  6. Woah! I’m really digging the template/theme of this website.
    It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal.
    I must say you’ve done a excellent job with this. Additionally, the
    blog loads extremely quick for me on Internet explorer. Superb Blog!

  7. Howdy this is kind of of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML.

    I’m starting a blog soon but have no coding expertise so I wanted to get guidance from someone with experience.

    Any help would be enormously appreciated!

  8. Hi there would you mind stating which blog platform
    you’re working with? I’m going to start my own blog in the near future but I’m having a hard time
    choosing between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your layout seems different then most blogs and I’m looking for something unique.
    P.S Apologies for being off-topic but I had to ask!

  9. Hello excellent website! Does running a blog like this take a great deal of work?

    I have no expertise in coding but I was hoping to start my
    own blog soon. Anyways, if you have any ideas or techniques for new blog owners please
    share. I know this is off topic but I simply had
    to ask. Kudos!

  10. Can I simply just say what a relief to uncover somebody that really knows what they are
    talking about on the net. You definitely realize how to bring an issue to light and make it important.
    More people need to check this out and understand this side of the
    story. I was surprised you’re not more popular given that you certainly have
    the gift.

  11. My brother suggested I may like this web site.
    He was totally right. This post actually made my day.

    You can not imagine just how a lot time I had spent for this info!
    Thanks!

  12. hey there and thank you for your info – I’ve certainly
    picked up anything new from right here. I did however expertise some technical issues using this website, as
    I experienced to reload the site a lot of times previous to I could get it to
    load properly. I had been wondering if your web host is OK?
    Not that I am complaining, but slow loading instances times will very frequently affect your placement in google
    and can damage your high-quality score if ads and marketing
    with Adwords. Anyway I am adding this RSS to my
    e-mail and could look out for a lot more of your respective
    exciting content. Ensure that you update this again very soon.

  13. Its like you read my mind! You appear to know a lot about this, like you
    wrote the book in it or something. I think that you could do with a few pics
    to drive the message home a little bit, but instead
    of that, this is magnificent blog. A fantastic
    read. I will definitely be back.

  14. Good post. I learn something totally new and challenging on blogs I stumbleupon every day.
    It will always be exciting to read through content from other writers and practice
    a little something from other web sites.

  15. I was recommended this blog via my cousin.
    I’m now not positive whether or not this publish is written by means of him as nobody else recognise such distinct approximately my difficulty.
    You’re incredible! Thank you!

  16. Normally I do not learn post on blogs, but I would like
    to say that this write-up very pressured me to try and do it!
    Your writing style has been amazed me. Thanks, quite great article.

  17. 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 success. If you know of any please share. Many thanks!

  18. Howdy! I know this is somewhat off topic but I
    was wondering which blog platform are you using for this website?
    I’m getting fed up of WordPress because I’ve had issues with hackers and I’m looking at alternatives for another platform.
    I would be awesome if you could point me in the direction of a good platform.

  19. Hi! This post could not be written any better! Reading through this post reminds me of my previous room mate!
    He always kept talking about this. I will forward this post to him.
    Pretty sure he will have a good read. Thank you for sharing!

  20. Hi there I am so happy I found your webpage, I really found you by accident, while I was
    looking on Aol for something else, Anyhow I am here now and
    would just like to say many thanks for a tremendous post and a all round thrilling blog (I also love the theme/design), I don’t have time
    to browse it all at the minute but I have book-marked it and also added
    your RSS feeds, so when I have time I will be back to
    read a great deal more, Please do keep up the awesome work.

  21. Hey there, I think your blog might be having browser compatibility
    issues. When I look at your blog in Safari, it looks fine but when opening in Internet Explorer,
    it has some overlapping. I just wanted to give you a quick heads up!
    Other then that, terrific blog!

  22. I love your blog.. very nice colors & theme. Did you
    make this website yourself or did you hire someone to do it
    for you? Plz reply as I’m looking to design my own blog and
    would like to find out where u got this from. thank you

  23. Good day! This post could not be written any better! Reading this post reminds me of my previous room mate!
    He always kept chatting about this. I will forward this page to
    him. Fairly certain he will have a good read. Thank you for sharing!

  24. I’m curious to find out what blog platform you are working with?

    I’m experiencing some minor security problems with my
    latest site and I would like to find something more
    secure. Do you have any suggestions?

Comments are closed.