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. of course like your web-site however you need to test the spelling on quite a few of your
    posts. A number of them are rife with spelling issues
    and I find it very troublesome to inform the truth nevertheless I’ll surely come again again.

  2. My family members every time say that I am wasting my time here at web, but I
    know I am getting familiarity all the time by reading such
    fastidious articles.

  3. necessary review. Also visit very own site to test out
    situs slot online. This kind of web site has received detection by situs slot online bets people in Negara sendiri.
    At this time there are various fascinating promos if people join presently.

  4. Does your site have a contact page? I’m having problems locating
    it but, I’d like to shoot you an email. I’ve got some ideas for your blog you might be interested in hearing.
    Either way, great site and I look forward to seeing it develop over time.

  5. Today, I went to the beachfront 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 totally off topic but I had to
    tell someone!

  6. Hmm it appears like your blog ate my first comment (it was extremely long) so I guess I’ll just sum it up what
    I had written and say, I’m thoroughly enjoying your blog.

    I as well am an aspiring blog blogger but I’m still new
    to the whole thing. Do you have any helpful hints for first-time blog writers?
    I’d certainly appreciate it.

  7. I like the helpful info you provide in your articles.
    I’ll bookmark your blog and check again here regularly.
    I’m quite certain I’ll learn plenty of new stuff right
    here! Good luck for the next!

  8. Fantastic beat ! I wish to apprentice even as you amend your web site, how could i subscribe for a weblog
    site? The account helped me a appropriate deal. I were tiny bit familiar of this your broadcast offered
    shiny transparent idea

  9. Hi, i read your blog from time to time and i own a similar one
    and i was just curious if you get a lot of spam remarks?
    If so how do you reduce it, any plugin or anything you can suggest?

    I get so much lately it’s driving me crazy so any support is very much appreciated.

  10. I’ve read a few just right stuff here. Certainly price bookmarking for
    revisiting. I wonder how so much effort you put to create this kind of excellent informative site.

  11. Hello, i read your blog from time to time and i
    own a similar one and i was just wondering
    if you get a lot of spam feedback? If so how do you reduce
    it, any plugin or anything you can suggest? I get so
    much lately it’s driving me insane so any assistance is very much appreciated.

  12. crucial review. Also visit one of the greatest site to own game slot online.
    The following incredible web-site has received name from
    judi slot video gaming people in Dalam negri. Certainly, there
    will be a few amazing promos if however, you join presently.

  13. Hi, I do believe this is a great web site. I stumbledupon it 😉 I’m going to come back yet again since I book marked it.
    Money and freedom is the best way to change, may you be rich and continue to guide others.

  14. Hey there, I think your site might be having browser compatibility issues.

    When I look at your blog in Opera, it looks fine but when opening in Internet Explorer, it has
    some overlapping. I just wanted to give you a quick
    heads up! Other then that, terrific blog!

  15. Pretty section of content. I just stumbled upon your weblog and
    in accession capital to assert that I acquire actually enjoyed account your blog posts.
    Any way I will be subscribing to your feeds and even I achievement you access consistently fast.

  16. Hi! This is my first visit to your blog! We are a collection of volunteers and starting a new initiative in a
    community in the same niche. Your blog provided us valuable information to
    work on. You have done a extraordinary job!

  17. We’re a gaggle of volunteers and opening a new scheme in our community.
    Your web site offered us with helpful information to
    work on. You have performed a formidable task and our whole
    community will probably be grateful to you.

  18. If some one desires expert view on the topic of blogging
    and site-building after that i propose him/her to pay a quick
    visit this blog, Keep up the fastidious job.

  19. I am extremely impressed with your writing skills and also with the layout on your blog.

    Is this a paid theme or did you customize it yourself? Either way keep up the nice quality writing, it is rare to see a great blog like this one these days.

  20. I’m gone to say to my little brother, that he should also pay a quick visit this webpage on regular basis to obtain updated from
    most recent news.

  21. Hey, I think your site might be having browser compatibility issues.
    When I look at your blog site in Opera, it looks fine but when opening in Internet Explorer, it has some overlapping.

    I just wanted to give you a quick heads up! Other then that,
    excellent blog!

  22. Heya i am for the primary time here. I came across this board and I in finding It
    truly helpful & it helped me out a lot. I am hoping
    to present one thing again and aid others such as
    you aided me.

  23. I loved as much as you will receive carried out right here.

    The sketch is tasteful, your authored material stylish.
    nonetheless, you command get got an edginess over that you wish be delivering
    the following. unwell unquestionably come more formerly again as exactly the same nearly
    very often inside case you shield this increase.

  24. Hi there to all, how is all, I think every
    one is getting more from this web page, and your
    views are good in favor of new users.

  25. Very good blog! Do you have any helpful hints for aspiring writers?
    I’m hoping to start my own site soon but I’m a little lost on everything.

    Would you advise starting with a free platform like WordPress or go for a paid option? There are so many choices out there that I’m completely overwhelmed ..
    Any recommendations? Kudos!

Comments are closed.