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. With havin so much content do you ever run into any issues
    of plagorism or copyright infringement? My blog has a
    lot of completely unique content I’ve either created myself or outsourced but it looks like a
    lot of it is popping it up all over the internet without my agreement.
    Do you know any methods to help reduce content from being stolen? I’d truly appreciate it.

  2. If you wish for to obtain a great deal from this paragraph then you have to apply these techniques
    to your won web site.

  3. Someone necessarily help to make seriously posts I might state.
    This is the very first time I frequented your web page and up to now?
    I amazed with the analysis you made to make this actual publish incredible.
    Magnificent activity!

  4. Ahaa, its fastidious discussion concerning this paragraph at this
    place at this webpage, I have read all that, so at
    this time me also commenting here.

  5. I like the valuable information you provide in your articles.
    I will bookmark your blog and check again here frequently.
    I am quite certain I will learn lots of new stuff right here!

    Best of luck for the next!

  6. Right here is the right web site for everyone who hopes to find out about this topic.
    You understand so much its almost tough to argue with you (not that I actually will need to…HaHa).
    You definitely put a brand new spin on a topic that has been discussed for
    a long time. Excellent stuff, just wonderful!

  7. Great info. Lucky me I recently found your blog by accident (stumbleupon).

    I’ve saved as a favorite for later!

  8. Hi! I’m at work browsing your blog from my new apple iphone!
    Just wanted to say I love reading your blog and look forward to all your posts!
    Keep up the superb work!

  9. critical review. In addition visit typically the site which is often enjoyed agen slot deposit pulsa.
    This amazing site has received good reputation using
    agen slot deposit pulsa betting people in Dalam negri.
    There are generally numerous appealing promos when you
    join now.

  10. Excellent site you’ve got here.. It’s difficult to find excellent writing like yours nowadays.
    I honestly appreciate individuals like you! Take care!!

  11. whoah this blog is excellent i love reading your articles.
    Stay up the good work! You know, a lot of persons are hunting round for this info, you could help them greatly.

  12. fantastic publish, very informative. I wonder why the opposite experts
    of this sector don’t realize this. You must continue your writing.
    I am sure, you have a great readers’ base already!

  13. Heya i am for the primary time here. I came across this board and
    I find It truly useful & it helped me out a lot.

    I am hoping to provide something back and help others like you aided me.

  14. This is the right webpage for anybody who wants to
    find out about this topic. You know a whole lot its
    almost hard to argue with you (not that I actually
    will need to…HaHa). You definitely put a fresh spin on a subject
    that has been written about for years. Great stuff, just
    wonderful!

  15. I’ve read some just right stuff here. Certainly value bookmarking for revisiting.
    I wonder how a lot effort you place to create any such
    magnificent informative site.

  16. Hi! I know this is kinda off topic nevertheless I’d figured I’d ask.
    Would you be interested in exchanging links or maybe guest writing a blog article or vice-versa?
    My site covers a lot of the same topics as yours and I think we could greatly benefit from
    each other. If you’re interested feel free to shoot me an e-mail.
    I look forward to hearing from you! Terrific blog by the way!

  17. Hello to all, how is all, I think every one is getting more from this site, and your views are pleasant in support of new viewers.

  18. naturally like your web-site but you need to take a look at the
    spelling on several of your posts. A number of them are rife
    with spelling issues and I find it very bothersome to tell the reality on the other hand I will definitely come back again.

  19. naturally like your web site however you have to take a look
    at the spelling on quite a few of your posts. Several of them
    are rife with spelling issues and I in finding it very troublesome to tell the truth
    then again I will surely come again again.

  20. Wow that was odd. I just wrote an very long comment but after I clicked submit my comment didn’t appear.

    Grrrr… well I’m not writing all that over again. Anyhow, just wanted
    to say great blog!

Comments are closed.