Category Archives: Code Club

Coding club – number guess

I am currently involved with a Coding Club for high schoolers at my kids school. Currently we are using Python. Coding in the browser using:

Our most recent discussion using a random number guess game.

import random

# Pick a random number
number = random.randint(0, 10)

# Now ask for guesses until the correct guess is made
done = False

while not done:
guess = int(raw_input('What is your guess?'))
print 'You guessed: %d' % guess

if guess < number: print 'Higher!' elif guess > number:
print 'Lower!'
print 'Right!'
done = True