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! Someone in my Facebook group shared this site with us
    so I came to give it a look. I’m definitely enjoying the information. I’m bookmarking
    and will be tweeting this to my followers! Great blog and wonderful style
    and design.

  2. A motivating discussion is worth comment. I believe that
    you should publish more on this issue, it might not be a taboo subject
    but generally people don’t discuss these topics.

    To the next! Many thanks!!

  3. Thanks for the good writeup. It if truth be told was once a enjoyment account it.
    Glance complex to far added agreeable from you! However, how can we
    be in contact?

  4. My programmer 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 variety
    of websites for about a year and am worried about switching
    to another platform. I have heard excellent things about
    blogengine.net. Is there a way I can transfer all my wordpress content into it?
    Any help would be really appreciated!

  5. Thanks , I have just been searching for info approximately this topic for a while and yours
    is the best I’ve found out till now. However, what concerning the conclusion? Are you certain in regards
    to the supply?

  6. After I originally left a comment I appear to have clicked on the -Notify me when new comments are added- checkbox and
    from now on every time a comment is added I get 4 emails with the exact same comment.

    Is there a means you are able to remove me from that service?
    Cheers!

  7. Hiya! Quick question that’s totally off topic.

    Do you know how to make your site mobile friendly? My blog looks
    weird when viewing from my iphone4. I’m trying to find a theme or plugin that might be
    able to resolve this issue. If you have any suggestions, please
    share. Cheers!

  8. Very great post. I simply stumbled upon your blog and wished to mention that I’ve really enjoyed surfing around your weblog posts.
    In any case I’ll be subscribing in your feed and I am hoping you write again soon!

  9. Does your site have a contact page? I’m having a tough time locating it but,
    I’d like to send you an email. I’ve got some creative ideas for your
    blog you might be interested in hearing. Either way, great blog
    and I look forward to seeing it expand over time.

  10. You should take part in a contest for one of the highest quality blogs on the internet.
    I am going to recommend this site!

  11. Greate post. Keep posting such kind of information on your page.
    Im really impressed by it.
    Hey there, You have done a fantastic job. I will certainly
    digg it and individually recommend to my friends.
    I am confident they will be benefited from this website.

  12. Hi this is kind of of off topic but I was wanting to know if blogs use
    WYSIWYG editors or if you have to manually code with HTML.
    I’m starting a blog soon but have no coding skills
    so I wanted to get guidance from someone with experience. Any help would be enormously appreciated!

  13. Hey I know this is off topic but I was wondering
    if you knew of any widgets I could add to my blog that automatically tweet my newest twitter updates.
    I’ve been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this.
    Please let me know if you run into anything. I truly enjoy reading your
    blog and I look forward to your new updates.

  14. I loved as much as you will receive carried out right here.

    The sketch is tasteful, your authored subject matter stylish.
    nonetheless, you command get got an shakiness over that you wish be delivering the following.
    unwell unquestionably come more formerly again since exactly the
    same nearly a lot often inside case you shield this increase.

  15. After I originally commented I seem to have clicked on the -Notify me
    when new comments are added- checkbox and now every
    time a comment is added I receive four emails with the same comment.
    There has to be an easy method you can remove me from that service?
    Thank you!

  16. Great blog! Do you have any hints for aspiring writers?

    I’m hoping to start my own blog soon but I’m a little lost on everything.
    Would you suggest starting with a free platform like WordPress or go for a paid option? There are so
    many options out there that I’m totally confused .. Any
    tips? Cheers!

  17. Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my blog that automatically tweet my
    newest twitter updates. I’ve been looking for a plug-in like this for quite
    some time and was hoping maybe you would have some experience with something like this.
    Please let me know if you run into anything.
    I truly enjoy reading your blog and I look forward to
    your new updates.

  18. Hi, I think your blog might be having internet browser compatibility problems.
    When I take a look at your web site in Safari, it looks fine however when opening in I.E.,
    it’s got some overlapping issues. I merely wanted to give you a quick heads up!

    Besides that, excellent website!

  19. I was wondering if you ever thought of changing the page layout of your site?
    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 one
    or two pictures. Maybe you could space it out better?

  20. I just couldn’t depart your site prior to suggesting that
    I extremely loved the usual info an individual provide for your visitors?
    Is going to be again often to investigate cross-check new posts

  21. I’m really impressed with your writing skills and also with the layout on your weblog.
    Is this a paid theme or did you modify it yourself? Either
    way keep up the excellent quality writing, it is rare to see
    a nice blog like this one these days.

  22. Undeniably imagine that which you stated. Your favourite justification seemed to be at the web the easiest factor to
    consider of. I say to you, I definitely get irked at the same time as other people think about worries that they just don’t understand about.
    You managed to hit the nail upon the highest and also outlined out the entire thing with no need side-effects ,
    other people can take a signal. Will likely be back to get more.
    Thanks

  23. After exploring a number of the articles on your web page, I really like
    your way of writing a blog. I saved as a favorite it to
    my bookmark webpage list and will be checking back in the near future.
    Please visit my web site too and tell me what you think.

  24. Simply desire to say your article is as surprising. The clearness to your
    publish is simply great and i could assume you are a professional in this subject.
    Fine along with your permission let me to grasp your feed to keep up to
    date with forthcoming post. Thanks one million and please carry on the
    gratifying work.

Comments are closed.