Higher or Lower
Higher or Lower is a numbers guessing game. In this game, the computer chooses a random number, and the user tries to guess what number the computer has chosen. There are many different ways to build this game, and many versions of this game have been built by different people.
Our version of the game will have two levels:
- An easy level
- A hard level
The computer will first choose a random, secret number between 1
and 100
. In the easy level, the user will get unlimited chances to guess the correct number. In the hard level, the user will only get three chances to guess the correct number, and then they will lose the game.
This game can be coded in different ways and still work well—this is one of the most awesome things about writing code. However, we will focus on writing code that uses a while
loop for the easy version and a for
loop for the hard version. This will let us practice our loops and build a game that has different levels of challenge.
To be successful in this...