Guessing game using Python
# AUTHOR : JAINISH LIMBACHIYA
# PURPOSE : Fun Guessing game in Python
# DATE : 22 AUGUST 2020
import random
hiddenNumber = random.randrange(1, 100)
chances = 4
print("Guess the number")
while chances != 0:
guess = int(input())
chances = chances-1
if guess == hiddenNumber:
print("You Won!")
break
elif guess > hiddenNumber:
print("Smaller Number Please")
print(chances, "chances left")
continue
else:
print("Higher Number Please")
print(chances, "chances left")
continue
__ OUTPUT __
Guess the number
50
Higher Number Please
3 chances left
60
You Won!
No comments: