第六课 我按照正常输入
num = 10
print('Guess what I think ?')
answer = input()
result = answer<num
print('Too small')
print result
result = answer > num
print('Too big')
print result
result = answer == num
print('equal')
print result
可是run的时候出现invalid syntax然后提示result有问题,为什么啊?求教
我google了一下,把程序改成这样可以运行了,好像是因为python版本不一样造成的,具体的目前还不清楚。
num = 10
print('Guess what I think ?')
answer = eval(input())
result = answer<num
print('Too small')
print(result)
result = answer > num
print('Too big')
print(result)
result = answer == num
print('equal')
print(result)