|
print("Let's play a game,Guess a number!")
print("You have three changes")
import random
num = random.randint(1,10)
i = 0
guess=0
while guess!=num and i <3:
guess = int(input('input a number!'))
if num == guess:
print('Congratulations'+' !'+' answer is '+str(num))
print('game over')
else:
i = i+1
a=3-i
print('you have '+str(a)+' change')
if a ==0:
print('You failed,game over')
print('answer is '+str(num))
|
|