Guessing Game
excerpt: This covers the basic building blocks such as Reading User Input, while Loop and Counter. tags: read-user-input while-loop counter
Write a guessing game where you have to guess a secret number between 1 and 100. After every guess the program tells the user whether the number was large or small. At the end, print the number of tries needed.
|
|
Replace the hard coded secret number with generating a random number between 1 and 100 (inclusive of 1 and 100):
|
|
Building Blocks
- Reading User Input
- while Loop
- Counter