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. I do not even understand how I finished up here, but I assumed this put up was great.
    I don’t understand who you’re but certainly you’re going to a famous blogger for those who aren’t
    already. Cheers!

  2. Hmm it seems like your blog ate my first comment (it was super long) so
    I guess I’ll just sum it up what I submitted and say, I’m thoroughly enjoying your blog.
    I too am an aspiring blog writer but I’m still new to the
    whole thing. Do you have any tips for first-time blog writers?
    I’d certainly appreciate it.

  3. Right here is the perfect web site for everyone who wants
    to understand this topic. You realize so much its almost tough to argue with you (not that I personally will need to…HaHa).

    You certainly put a brand new spin on a subject that’s been discussed
    for decades. Excellent stuff, just excellent!

  4. of course like your web site however you need to test the spelling on several of your posts.
    Several of them are rife with spelling problems and I in finding it very bothersome to tell the reality nevertheless I’ll
    surely come again again.

  5. It’s not my first time to pay a visit this web site,
    i am visiting this site dailly and obtain good data from here daily.

  6. I have read several just right stuff here.
    Certainly worth bookmarking for revisiting. I surprise
    how a lot attempt you put to create this kind of great informative site.

  7. Today, I went to the beach front 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 put 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 completely
    off topic but I had to tell someone!

  8. I have been browsing online greater than three hours lately,
    but I by no means found any attention-grabbing article like yours.

    It’s lovely price sufficient for me. In my opinion, if all site owners and bloggers made excellent content as you did,
    the internet will be much more useful than ever before.

  9. I’ve been browsing online more than three
    hours today, yet I never found any interesting article
    like yours. It is pretty worth enough for me. In my view, if all web owners and bloggers
    made good content as you did, the web will be a lot more useful than ever
    before.

  10. Fine way of explaining, and fastidious piece of writing
    to obtain facts on the topic of my presentation topic, which i am going to present in academy.

  11. Excellent beat ! I wish to apprentice even as you amend your site,
    how could i subscribe for a weblog web site? The account helped
    me a appropriate deal. I were a little bit familiar of this your broadcast provided vibrant transparent concept

  12. I have been browsing on-line more than three hours as of late, but I never discovered
    any interesting article like yours. It is beautiful worth sufficient for me.

    In my view, if all webmasters and bloggers made excellent content material as you did, the net will likely be a lot more useful than ever before.

  13. Greetings! I know this is kinda off topic however I’d figured
    I’d ask. Would you be interested in exchanging links
    or maybe guest authoring a blog article or vice-versa? My site
    goes over 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 send me an e-mail.
    I look forward to hearing from you! Terrific blog by the way!

  14. critical review. In the same way visit our personal site that can be played slot deposit pulsa.

    Wonderful web site has received title coming from game slot on line casino competition in Negara sendiri.
    So there will be many handy promos when you join today.

  15. I don’t even know how I ended up here, but I thought this post was good.

    I don’t know who you are but definitely you’re going
    to a famous blogger if you aren’t already 😉 Cheers!

  16. I think this is among the so much significant information for me.

    And i’m glad studying your article. However wanna commentary on some general issues,
    The site style is perfect, the articles is truly nice :
    D. Good activity, cheers

  17. 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 can do with a few pics to drive the message home a
    bit, but other than that, this is great blog.
    An excellent read. I’ll certainly be back.

  18. stimulating review. Moreover visit all of
    our site that will be gamed game slot. This web site has received endorsement via agen slot pulsa video games people in Negara sendiri.
    Certainly, there will be loads of a good idea promos should you join at
    present.

  19. naturally like your web-site but you need to test the spelling on several of your posts.
    Several of them are rife with spelling problems and I in finding it very troublesome to inform the reality however I will definitely come again again.

  20. Greetings from Idaho! I’m bored to tears at work
    so I decided to browse your site on my iphone during lunch break.
    I enjoy the knowledge 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 phone ..
    I’m not even using WIFI, just 3G .. Anyways, fantastic site!

  21. Hi there! I know this is kinda off topic however , I’d figured I’d ask.
    Would you be interested in exchanging links or maybe guest authoring
    a blog article or vice-versa? My site goes over a lot
    of the same subjects as yours and I think we could greatly
    benefit from each other. If you’re interested feel
    free to send me an e-mail. I look forward to hearing from you!
    Superb blog by the way!

Comments are closed.