Python Number Guessing Game
Python Number guessing Game
We create a Number Guessing Game using Random Module. If you
learn Random Module then back little bit.
Example:
Write the code for number guessing program and enjoy it.
while True:
import random
cn=random.randrange(0,9)
choice=input("If you are quit then
type 'Q' or 'q' other wise press Enter----")
if choice=="Q" or choice=="q":
break
un=int(input("Guess a Number: "))
if un>cn:
print("Draw Number is: ",cn)
print("Sorry, Your guess
Number is Too High.")
elif cn>un:
print("Draw Number is: ", cn)
print("Sorry, Your guess
Number is Too Low.")
else:
print("Draw Number is: ", cn)
print("Congrutulation, You
Win")
<<Try yourself>>
Learn Random Module then click previous button
Post a Comment