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. I’ve read a few just right stuff here. Definitely
    price bookmarking for revisiting. I surprise how so much effort you put to make one of these
    fantastic informative website.

  2. What i don’t realize is if truth be told how you’re now not actually
    a lot more neatly-appreciated than you might be now. You are so intelligent.
    You know therefore significantly in terms
    of this matter, made me in my opinion believe it from a lot of various angles.
    Its like men and women don’t seem to be fascinated unless it’s
    something to do with Woman gaga! Your own stuffs excellent.

    All the time maintain it up!

  3. Simply desire to say your article is as surprising. The clarity in your post is simply nice and i could assume
    you’re an expert on this subject. Well with
    your permission let me to grab your feed to keep up to date with forthcoming post.
    Thanks a million and please carry on the enjoyable work.

  4. Right here is the right website for everyone who would like to find out about this topic.
    You know so much its almost hard to argue with you (not that I personally will need to…HaHa).
    You certainly put a fresh spin on a subject that has been written about for years.
    Excellent stuff, just great!

  5. I’m curious to find out what blog platform you
    are utilizing? I’m having some minor security issues with my latest website and I would like to find something more safeguarded.
    Do you have any suggestions?

  6. hey there and thank you for your info – I have definitely picked
    up something new from right here. I did however expertise a few technical issues using this web site, since I experienced to reload the
    website a lot 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 could damage your high-quality score
    if ads and marketing with Adwords. Anyway I’m
    adding this RSS to my e-mail and could look out for a lot more of your respective exciting
    content. Make sure you update this again soon.

  7. A motivating discussion is definitely worth comment.
    There’s no doubt that that you ought to write more on this subject,
    it may not be a taboo matter but typically people don’t discuss
    these subjects. To the next! All the best!!

  8. I like the valuable information you provide in your articles.

    I’ll bookmark your weblog and check again here frequently.
    I’m quite certain I’ll learn plenty of new stuff right here!
    Best of luck for the next!

  9. Hey this is somewhat 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 experience so I wanted to get advice from someone with experience.
    Any help would be enormously appreciated!

  10. I’ll right away snatch your rss feed as I can’t in finding your e-mail subscription link or newsletter
    service. Do you’ve any? Kindly allow me recognize so that I
    may just subscribe. Thanks.

  11. Hey There. I found your blog using msn. This is a very well written article.
    I will make sure to bookmark it and come back to read more of your useful info.
    Thanks for the post. I’ll certainly comeback.

  12. Hello just wanted to give you a quick heads up.
    The words 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
    internet browser compatibility but I thought I’d post
    to let you know. The design look great though! Hope you get the issue fixed soon.
    Thanks

  13. Today, I went to the beach with my children. 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!

  14. Have you ever considered writing an ebook or guest authoring on other sites?
    I have a blog centered on the same ideas you discuss and would
    really like to have you share some stories/information.
    I know my audience would value your work. If you’re even remotely interested,
    feel free to send me an e mail.

  15. Its like you read my mind! You seem to know so much about this, like you wrote the book in it or
    something. I think that you could do with some pics to drive
    the message home a little bit, but other than that, this is wonderful
    blog. A great read. I will certainly be back.

  16. Excellent goods from you, man. I have understand your stuff previous to and you’re just extremely wonderful.
    I actually like what you’ve acquired here, certainly like what you’re stating and the way in which you say
    it. You make it entertaining and you still take care of to keep it sensible.
    I can not wait to read far more from you. This is really a wonderful web site.

  17. Hi there, just became aware of your blog through Google, and found that it is really informative.
    I am going to watch out for brussels. I will be grateful if you continue this {in future}.
    Numerous people will be benefited from your writing.
    Cheers!

  18. Hey There. I found your blog using msn. This is an extremely well written article.
    I will make sure to bookmark it and return to read
    more of your useful information. Thanks for the post.
    I’ll certainly comeback.

  19. I’ve been browsing on-line greater than three hours these days,
    yet I never discovered any fascinating article like yours.
    It’s beautiful worth enough for me. In my view, if all webmasters and bloggers made excellent content material as you did, the
    internet might be much more useful than ever before.

  20. Nice blog! Is your theme custom made or did you download it from somewhere?
    A design like yours with a few simple tweeks would really make my blog stand out.
    Please let me know where you got your design. Kudos

  21. This design is steller! You obviously know how to keep a reader amused.
    Between your wit and your videos, I was almost moved to
    start my own blog (well, almost…HaHa!) Fantastic job.
    I really loved what you had to say, and more than that, how you
    presented it. Too cool!

  22. This is the right web site for anyone who wishes to understand this topic.

    You realize a whole lot its almost tough to argue with you
    (not that I personally would want to…HaHa).

    You definitely put a brand new spin on a subject which has been discussed for a long time.
    Excellent stuff, just excellent!

  23. The other day, while I was at work, my cousin stole my iPad and tested to see if it can survive a 30 foot drop, just so she
    can be a youtube sensation. My apple ipad is now destroyed
    and she has 83 views. I know this is totally off topic but I had to share it with someone!

  24. Hi there! This is my first visit to your blog! We are a group of volunteers and starting
    a new project in a community in the same niche. Your
    blog provided us beneficial information to work on. You have done a outstanding
    job!

  25. Whats up this is kinda 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!

  26. Hey there, You’ve done an excellent job. I will definitely
    digg it and personally suggest to my friends. I’m confident they will be benefited from
    this web site.

Comments are closed.