Basic Number-Guessing Game

Objective
In this lesson, students will learn:

  • How to create a simple number guessing game

Here’s what your game should do:

  • Ask the player to guess a mystery number between 0 and 99.
  • Allow the player to enter a guess in a textfield by clicking a button.
  • Use an if statement to figure out if the number entered is greater than, less than, or the same as the mystery number.
  • Display a message that tells the player if they guessed too low, too high, or are correct.

The image shows how the game should work when it runs.

Advertisements