Guess a number game in python
from random import randint
beg=int(input("Enter a number where you want to begin"))
end=int(input("Enter a number where you want to end"))
def choose_num(n):
r=randint(beg,end)
if n>=beg and n<=end:
if n==r:
print("Congrats you guess it! ")
print()
else:
print("Number is",r, "try again")
print()
else:
print("Sorry number is out of range")
print()
n=0
while True:
if n!=-1:
n=int(input("Guess a number"))
choose_num(n)
else:
break
Comments
Post a Comment
If you have any doubt you ask me in comment section