Difference between revisions of "Guessing Game Assignment"
From WLCS
Line 7: | Line 7: | ||
'''Guessing Game Algorithm''' | '''Guessing Game Algorithm''' | ||
− | + | # Generate a random number from 0 to 100 | |
+ | <source lang="python"> | ||
+ | import random (at the very top) | ||
+ | randomNum = random.randint(0, 100) | ||
+ | </source> | ||
+ | |||
+ | # |
Revision as of 14:07, 24 October 2008
Guessing Game Rules
- Mr. Bui will think of a number from 0 to 100
- You will guess a number
- Mr. Bui will tell you to guess higher or lower
- You will guess again, and so on and so forth.
Guessing Game Algorithm
- Generate a random number from 0 to 100
import random (at the very top)
randomNum = random.randint(0, 100)