3. Game Time
Robots were not able to make
decisions for themselves
Had to give them very precise
instructions
Source: http://www.raspberrypi.org/learning/turing-test-lessons/Lesson-1/lesson-plan-1.md
4. Program Code
Execute statements in sequence
Control flow
Statement that is currently executing
Statement that is next
Source: http://www.raspberrypi.org/learning/turing-test-lessons/Lesson-1/lesson-plan-1.md
5. Turtle Program
Draw a rectangle, triangle, “s” shape
Students to draw a square
>>> import turtle
>>> turtle.forward(0)
6. Dragon Game
Demo the full game.
Source: http://inventwithpython.com/chapter6.html
7. Dragon Game - Intro
print(“You are in a land full of dragons.”)
print(“In front of you, you see two caves.”)
print(“In one cave, lives a good dragon ”)
print(“who will share his treasure with you.”)
print(“In the other lives a bad dragon ”)
print(“who will eat you on sight!”)
print()
20. Datatypes cannot be mixed
your_age = int(input(“Your age?”))
my_age = 30
older_by = my_age – your_age
input function always returns a string. Convert
it to a number using the int (for integer)
function.
Editor's Notes
Get 4 volunteer students. Make three of them variables a, b, and c by giving them hats with labels ‘a’, ‘b’, and ‘c’ respectively. The 4th volunteer is the computer, give her a hat with the picture of a motherboard. Now ask the computer to execute the first statement ‘a = 10’ by taking a board labled ‘10’ and handing it over to the student wearing the ‘a’ hat. Similarly execute the second statement ‘b = 5’. Then tell the computer to calculate the sum of the values in a and b and hand the result to ‘c’. The computer should take a board labeled ‘15’ and hand it to ‘c’.
Ask the class what will be the output of the last statement.