Challenge: Guess the Number

Test yourself by coding a small game.

Problem statement

Write a simple game where the player must find a hidden number drawn from a collection of numbers like [12, 65, 87, 113, 1, 5].

  • When the proposed number is lower than the hidden number, the game outputs: Your guess is too low.

  • When the proposed number is higher than the hidden number, the game outputs: Your guess is too high.

  • When the proposed number is equal to the hidden number, the game outputs: You win. And then stops.

  • The player can make as many proposals as they wants.

  • Again, the player may stop the game by entering the word "stop".

 Sample input

Get hands-on with 1200+ tech skills courses.