Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've also run elementary school coding classes and my lesson plans and class engagement are largely the same as the OP.

The differences were just that I used Python rather than Perl and the program was a higher / lower game:

  from random import randint
  
  random_number = randint(1, 100)
  guess = 0
  
  while guess != random_number:
    guess = int(input("Guess a number: "))
    if guess > random_number:
      print("Too high!")
    
    if guess < random_number:
      print("Too low!")
  
    if guess == random_number:
      print("You win!")
(there's obviously a lot of ways you'd write this as better code but the point was to teach the absolute basics)

So the basic concept of the program is essentially the same (command line based and integer comparisons) but it's structured as a game. I too encouraged the kids to hack their programs and they loved it! In fact at every stage of the class, from teaching how strings work (eg below)....

  name = input("What is your name? ")
  print("Hello " + name)
...to the completed game, I gave kids time to hack the code and adapt it how they wanted. Kids genuinely loved it. They'd put silly code in as jokes and found it hysterical that the computers repeated their silly code etc. They were very much engaged.

Obviously there will always be outliers who don't enjoy those types of lessons -- I mean everyone is different after all. But this kind of structure for teaching code is actually very effective for engaging the majority of the class.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: