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. I just like the valuable information you supply to your articles.
    I will bookmark your blog and take a look at again here regularly.
    I am quite certain I will be informed lots of new stuff proper here!
    Good luck for the next!

  2. Superb blog you have here but I was curious about if
    you knew of any forums that cover the same topics discussed in this article?
    I’d really like to be a part of group where I can get advice from other knowledgeable
    individuals that share the same interest. If you have any recommendations,
    please let me know. Cheers!

  3. I don’t know if it’s just me or if everybody else encountering issues
    with your site. It appears as if some of the
    text within your posts are running off the screen. Can somebody else please provide feedback and let
    me know if this is happening to them too? This may be
    a problem with my internet browser because I’ve had this happen previously.
    Thank you

  4. First off I want to say wonderful blog! I had a quick question in which I’d
    like to ask if you don’t mind. I was curious to know how you center yourself and clear your mind prior to writing.

    I have had a hard time clearing my thoughts in getting my
    thoughts out there. I do enjoy writing but it just seems like the first 10
    to 15 minutes tend to be lost just trying to figure out
    how to begin. Any recommendations or tips?

    Appreciate it!

  5. I’m not certain where you’re getting your info, however great topic.
    I needs to spend some time learning much more or figuring out more.
    Thanks for wonderful info I was searching for this information for my mission.

  6. I like what you guys are usually up too. This kind of clever work and
    coverage! Keep up the awesome works guys I’ve incorporated you guys to my blogroll.

  7. Hmm it appears like your website ate my first comment (it was super long) so I
    guess I’ll just sum it up what I submitted and say, I’m thoroughly enjoying your blog.

    I as well am an aspiring blog writer but I’m still new to the whole thing.
    Do you have any tips and hints for inexperienced blog writers?
    I’d definitely appreciate it.

  8. I must thank you for the efforts you’ve put in writing this
    blog. I am hoping to check out the same high-grade blog
    posts from you later on as well. In fact, your creative writing
    abilities has inspired me to get my own site now 😉

  9. Aw, this was an incredibly good post. Taking a few minutes and actual effort to make a good article… but
    what can I say… I hesitate a lot and never seem to get anything done.

  10. I was very happy to find this website. I
    want to to thank you for ones time due to this fantastic read!!
    I definitely enjoyed every part of it and
    I have you saved as a favorite to look at new things in your site.

  11. Hi there, I found your web site by way of Google even as searching for a comparable matter, your site got here up, it seems to be great.
    I have bookmarked it in my google bookmarks.

    Hi there, just become aware of your weblog via Google, and
    found that it’s really informative. I am gonna watch out for
    brussels. I’ll be grateful for those who continue this {in future}.

    Many folks will probably be benefited from your writing. Cheers!

  12. Hmm is anyone else experiencing problems with the pictures on this blog loading?
    I’m trying to find out if its a problem on my end or if
    it’s the blog. Any responses would be greatly appreciated.

  13. Woah! I’m really loving the template/theme of this blog.
    It’s simple, yet effective. A lot of times it’s tough to get that “perfect balance” between user friendliness and appearance.
    I must say that you’ve done a superb job with this.
    Also, the blog loads extremely fast for me on Internet explorer.
    Excellent Blog!

  14. You really make it seem so easy together with
    your presentation but I to find this topic to be really something which I
    think I might by no means understand. It sort of feels
    too complicated and extremely broad for me. I am looking ahead to your subsequent post,
    I’ll attempt to get the dangle of it!

  15. My partner and I stumbled over here from a different page and
    thought I might check things out. I like what I see so i am just following you.
    Look forward to looking at your web page yet again.

  16. Hello! I know this is kinda off topic however , I’d
    figured I’d ask. Would you be interested in trading links
    or maybe guest authoring a blog post or vice-versa?
    My website addresses 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 e-mail. I look forward to hearing from you!
    Wonderful blog by the way!

  17. Hello there! I know this is kinda off topic but I
    was wondering which blog platform are you using for
    this website? I’m getting tired 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.

  18. whoah this blog is excellent i really like studying your articles.
    Stay up the great work! You already know, a lot of people
    are searching around for this information, you can aid them greatly.

  19. you’re in reality a just right webmaster. The website loading
    pace is amazing. It kind of feels that you are doing any distinctive trick.
    Furthermore, The contents are masterpiece. you have done a wonderful
    task on this subject!

  20. What i don’t understood is actually how you’re not actually much more smartly-preferred than you may be right now.
    You’re so intelligent. You know thus significantly when it comes to this matter, produced me personally imagine it from numerous various angles.
    Its like women and men are not involved unless it’s one thing to do with Woman gaga!

    Your individual stuffs outstanding. At all times maintain it up!

  21. Nice weblog here! Additionally your website loads up fast!
    What web host are you using? Can I get your associate link to your host?
    I wish my web site loaded up as quickly as yours lol

  22. Hello, i think that i saw you visited my site so i came to
    “return the favor”.I am attempting to find things to enhance my
    web site!I suppose its ok to use a few of your ideas!!

  23. I absolutely love your blog and find nearly all
    of your post’s to be just what I’m looking for.

    can you offer guest writers to write content for
    you? I wouldn’t mind publishing a post or elaborating on a few of the subjects you write regarding here.

    Again, awesome site!

  24. 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 four emails with the same comment. Is
    there any way you can remove me from that service?
    Many thanks!

  25. My developer is trying to convince me to move to .net from PHP.
    I have always disliked the idea because of the expenses.

    But he’s tryiong none the less. I’ve been using WordPress on a number of websites
    for about a year and am concerned about switching to another platform.

    I have heard great things about blogengine.net. Is
    there a way I can transfer all my wordpress posts into it?

    Any kind of help would be greatly appreciated!

  26. I truly love your blog.. Very nice colors & theme. Did you make this web site yourself?
    Please reply back as I’m trying to create my own personal website and want to learn where you got this from or
    just what the theme is named. Appreciate it!

  27. Its like you read my thoughts! You appear to know a lot approximately this,
    like you wrote the book in it or something.

    I feel that you can do with a few percent to drive the message
    house a bit, however instead of that, that is magnificent blog.
    A great read. I’ll definitely be back.

  28. Valuable information. Fortunate me I discovered your web site by accident, and I am surprised why this
    twist of fate didn’t came about in advance! I bookmarked it.

  29. Hi there! 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 back up.
    Do you have any solutions to stop hackers?

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

  31. Wow, incredible blog format! How lengthy have you been blogging for?
    you make blogging glance easy. The overall glance of your website is excellent,
    let alone the content!

Comments are closed.