Exercise: Number guessing game
In this exercise we are starting to build a game, called the number guessing game.
The game is that the computer "thinks" about a number and we have to guess it. On every guess, the computer will tell us if our guess was smaller or bigger than the hidden number. The game ends when we find the number.
This exercise is the first step of this game.
Create a simple command line game guessing a whole number.
- Let the computer "think" about a whole number between 1-200.
- Let the user guess a number.
- Tell the user if his guess was bigger or smaller than the number the computer "thought" of or tell them if they hit the right number.
- At this point the user only has one guess, though as a bounus you can allow the user to guess several times.
Solutions
Published on 2015-10-18