Make The Guess Game using python


 

Hey guys once again welcome to the decoders blog I hope you all are doing well and today I'm present with a simple guessing the number game which you can create using python, The given code will help you to built it so just follow the codes and make your guess game , and enjoy it by playing with your friends
print("WELCOME TO THE GUESS GAME")
print("guess a number between 0-50")
print("total number of attempts 3")
#number from the player
number=37
i=0
while(True):
while(True):
i=i+1
num1=int(input("enter your number \n"))
if 1<=i<=2:
if num1>37:
print("enter a smaller number")
print("attempts left", 3-i)
continue
elif num1<37:
print("enter a greater number")
print("attempts left", 3-i)
continue
elif num1==37:
print("you won the game")
print("in total", 3-i,"attempts")
continue
else:
print("you loose")
print("game over")

 

Comments

Popular Posts