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,273 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku

  1. Usually I do not learn post on blogs, but I wish to say that this write-up very compelled me to check out and do it!

    Your writing taste has been surprised me. Thanks, very nice post.

  2. For most recent news you have to visit world-wide-web
    and on web I found this web site as a most excellent web site for most up-to-date
    updates.

  3. Greetings! Quick question that’s entirely off topic. Do you know how to make
    your site mobile friendly? My blog looks weird when browsing from my iphone4.

    I’m trying to find a template or plugin that might be able to resolve this problem.
    If you have any suggestions, please share.

    Appreciate it!

  4. Amazing! Its really remarkable piece of writing, I have got much clear idea about from this piece
    of writing.

  5. My brother suggested I might like this website.

    He was totally right. This post truly made
    my day. You cann’t imagine simply how much time I had spent for
    this information! Thanks!

  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 usability and appearance. I must say that you’ve done a excellent job with
    this. Additionally, the blog loads extremely quick for me on Firefox.
    Superb Blog!

  7. Thanks , I have just been looking for information approximately this subject for a long time and yours
    is the greatest I’ve found out so far. However,
    what concerning the conclusion? Are you positive about
    the supply?

  8. I’ve been browsing on-line greater than three hours these days, but
    I by no means found any interesting article like yours. It’s beautiful worth enough for me.
    In my opinion, if all webmasters and bloggers made just
    right content as you did, the internet will be much more useful than ever before.

  9. I used to be recommended this website through my cousin.
    I’m no longer positive whether this put up is written by
    him as nobody else know such special approximately my problem.

    You are wonderful! Thank you!

  10. Thanks for your personal marvelous posting! I definitely enjoyed reading it,
    you will be a great author. I will make certain to bookmark your blog and will often come back someday.
    I want to encourage yourself to continue your great writing, have a nice morning!

  11. of course like your web site however you have to test the spelling on several
    of your posts. A number of them are rife with spelling issues and I in finding it very bothersome to tell
    the truth nevertheless I will certainly come again again.

  12. An intriguing discussion is definitely worth comment.
    I believe that you ought to publish more on this subject, it might not be a taboo matter but generally people don’t discuss these topics.
    To the next! All the best!!

  13. Link exchange is nothing else except it is simply placing the other person’s website link on your page
    at proper place and other person will also do similar for you.

  14. Thanks for every other wonderful article. The place else could anyone get that type
    of information in such a perfect approach of writing?
    I’ve a presentation next week, and I’m on the search for such info.

  15. Wow, incredible blog layout! How long have you been blogging for?
    you made blogging look easy. The overall look of your web site
    is fantastic, let alone the content!

  16. I seriously love your blog.. Pleasant colors & theme.
    Did you create this website yourself? Please reply back as
    I’m wanting to create my own blog and would love to find out where you got this from
    or just what the theme is named. Thank you!

  17. Thanks for sharing your thoughts. I truly appreciate your efforts and I am waiting for
    your further post thank you once again.

  18. interesting review. Furthermore visit my, personal site to understand agen slot deposit pulsa.

    This page has received good reputation together with agen slot pulsa gambling
    establishment players in Dalam negeri. There will be various wanted promos if however you join at the moment.

  19. What’s Taking place i’m new to this, I stumbled upon this I have discovered It positively
    helpful and it has aided me out loads. I am hoping to contribute & assist other customers like its aided me.
    Good job.

Comments are closed.