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 for … in.

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.

16,626 thoughts on “Contoh Soal Pemrograman – Pola Segitiga Siku-siku”

  1. Hi, I do think this is an excellent web site. I stumbledupon it 😉 I may
    revisit yet again since I book marked it. Money and freedom is the best way to change, may you be rich and continue to help
    other people.

  2. Its like you read my mind! You seem to understand a lot approximately this, like you wrote the
    e book in it or something. I believe that you can do with a few
    p.c. to force the message house a little bit, but other
    than that, that is great blog. A fantastic read. I will
    certainly be back.

  3. Quality posts is the crucial to interest the users to pay a quick visit the web site, that’s what this web page is providing.

  4. hello!,I like your writing very a lot! proportion we communicate extra about your post on AOL?
    I need an expert on this area to solve my problem.
    May be that is you! Having a look ahead to look you.

  5. Its like you read my mind! You seem 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 bit, but instead of that, this is fantastic blog.

    A great read. I’ll certainly be back.

  6. Wow that was strange. I just wrote an extremely long comment but after I clicked
    submit my comment didn’t appear. Grrrr… well I’m
    not writing all that over again. Regardless, just wanted to say wonderful blog!

  7. Hi, I do believe this is an excellent blog. I stumbledupon it 😉 I may return once again since
    I saved as a favorite it. Money and freedom is the best way to change, may you
    be rich and continue to guide others.

  8. Greetings from Florida! I’m bored at work so I decided to browse your site on my iphone during lunch break.
    I enjoy the info you provide here and can’t wait to take a look when I get home.
    I’m shocked at how fast your blog loaded on my cell phone ..
    I’m not even using WIFI, just 3G .. Anyhow,
    fantastic blog!

  9. I just like the valuable info you provide on your articles.
    I will bookmark your weblog and take a look at once more here
    regularly. I am reasonably sure I will be informed
    many new stuff right here! Good luck for the next!

  10. I’ve read several excellent stuff here. Definitely value bookmarking for
    revisiting. I wonder how so much effort you put to create this kind of wonderful informative web site.

  11. Hi there! Do you know if they make any plugins to assist
    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. Appreciate it!

  12. Hola! I’ve been reading your blog for some time
    now and finally got the bravery to go ahead and give you a shout out from Kingwood Tx!
    Just wanted to tell you keep up the fantastic job!

  13. I do not know whether it’s just me or if everyone else encountering problems with your blog.
    It looks like some of the written text in your
    content are running off the screen. Can somebody else please comment and
    let me know if this is happening to them too? This
    could be a problem with my web browser because I’ve had this happen previously.
    Appreciate it

  14. Attractive section of content. I just stumbled upon your
    web site and in accession capital to assert that I get actually enjoyed account your blog posts.
    Anyway I’ll be subscribing in your feeds or even I fulfillment you get admission to consistently rapidly.

  15. important review. Furthermore visit my very own site to obtain slot.
    Wonderful web-site has received unloathness received from slot pulsa online gambling rivalry in Negara sendiri.
    Truth be told there are numerous fascinating promos if you ever join currently.

  16. Its such as you read my mind! You appear to know so much approximately this, such as
    you wrote the ebook in it or something. I feel that you just could do with some percent to power the message house a little bit, however instead of
    that, this is fantastic blog. An excellent read.
    I’ll certainly be back.

  17. Attractive component to content. I just stumbled upon your blog and in accession capital to assert that I
    acquire actually enjoyed account your blog posts. Any
    way I’ll be subscribing to your augment and
    even I success you get admission to consistently
    quickly.

  18. Hi! This is kind of off topic but I need some guidance from an established blog.
    Is it hard to set up your own blog? I’m not very techincal but I can figure things out pretty fast.
    I’m thinking about setting up my own but I’m not sure where to begin. Do you have any ideas or suggestions?
    Appreciate it

  19. intriguing review. Similarly visit the actual site
    to examine judi slot online. This great site has received identification coming from video slot machine gambling
    participants in Dalam negeri. Truth be told
    there are loads of appealing promos if you join here.

Comments are closed.