Author Topic: Programming with the kids  (Read 344 times)

Dragon

  • Administrator
  • Platinum Level
  • *****
  • Posts: 4472
  • Trogdor!
    • My Funagain Games Wishlist
Programming with the kids
« on: January 14, 2017, 16:30:42 »
My oldest kids have started programming in Python at school. I think it's really cool. I was showing some stuff to my daughter and had suggested using rainbow colors for a circle. (Originally, I she was drawing multiple circles, with different colors for each one, but the words came out a little different as I was leaving the room.) My son took up the challenge though and came up with this... which I just had to show off...

Attached is a screenshot of the end result... he said it's not perfect, but I told him he can update it, but this was great. (This was done on repl.it.) I'm going to challenge my kids some more with this...

Code: [Select]
import turtle

t = turtle.Turtle()
t.speed(100)

for i in range(11):
  t.pencolor('red')
  t.forward(10)
  t.right(5)
for i in range(11):
  t.pencolor('orange')
  t.forward(10)
  t.right(5)
for i in range(11):
  t.pencolor('yellow')
  t.forward(10)
  t.right(5)
for i in range(11):
  t.pencolor('green')
  t.forward(10)
  t.right(5)
for i in range(10):
  t.pencolor('blue')
  t.forward(10)
  t.right(5)
for i in range(11):
  t.pencolor('purple')
  t.forward(10)
  t.right(5)
for i in range(10):
  t.pencolor('pink')
  t.forward(10)
  t.right(5) 
"Hello IT. Have you tried turning it off and on again? ... OK, well, the button on the side. Is it glowing?... Yeah, you need to turn it on. Err, the button turns it on. Yeah, you do know how a button works, don't you? No, not on clothes." - Roy (The IT Crowd)