Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Exercise: Number

Turn the Number guessing game into a class. Replace every print statement with a call to an output method. Do the same with the way you get the input. Then create a subclass where you override these methods. You will be able to launch the game with a hidden value you decide upon. The input will feed a pre-defined list of values as guesses to the game and the output methods will collect the values that the game prints in a list.