Hi Lo Examples

example game 3

In this example, the user uses lowercase letters and types invalid inputs.

$ python3 hilo.py
Given a series of random numbers between 1 and 13, guess
if the next number will be higher or lower. Each time the you guess
correctly, you get one point. If you guess incorrectly, you'll get
charged for making one mistake. The goal of the game is to see how many
times you can guess correctly before you make 3 mistakes.

Good luck!

First number: 2
(H)igher or (L)ower?: higher
Oops! You can only guess H or L. Try again.
(H)igher or (L)ower?: h
Correct! The number was 12.
-----------------------
Score: 1	Mistakes: 0
-----------------------

Last number: 12
(H)igher or (L)ower?: lo
Oops! You can only guess H or L. Try again.
(H)igher or (L)ower?: low
Oops! You can only guess H or L. Try again.
(H)igher or (L)ower?: lh
Oops! You can only guess H or L. Try again.
(H)igher or (L)ower?: hi
Oops! You can only guess H or L. Try again.
(H)igher or (L)ower?: h
Correct! The number was 12.
-----------------------
Score: 2	Mistakes: 0
-----------------------

Last number: 12
(H)igher or (L)ower?: h
Incorrect. The number was 2.
-----------------------
Score: 2	Mistakes: 1
-----------------------

Last number: 2
(H)igher or (L)ower?: l
Incorrect. The number was 9.
-----------------------
Score: 2	Mistakes: 2
-----------------------

Last number: 9
(H)igher or (L)ower?: l
Correct! The number was 8.
-----------------------
Score: 3	Mistakes: 2
-----------------------

Last number: 8
(H)igher or (L)ower?: l
Incorrect. The number was 10.
-----------------------
Score: 3	Mistakes: 3
-----------------------

Game over! You got 3 points.