& 应改为 and
另外你的缩进格式有问题
answer=8
time=0
temp=input("enter a number which is between 1 and 10:")
guess =int(temp)
if answer ==guess:
print("your sister is gorgerousif,game over")
assert(answer ==guess)
else:
if answer<guess:
print("bigger,you still have 2 chance")
time=1+time
print(time)
else:
print("litter,you still have 2 chance")
time=1+time
print(time)
while guess!=8 and time<3:
temp=input("fault,try again:")
guess =int(temp)
if answer ==guess:
print("your sister is gorgerousif,game over")
break
else:
if answer<guess:
print("bigger")
time=1+time
print(time)
else:
print("litter")
time=1+time
print(time)
|