小甲鱼零基础入门Python实验零
视频中源代码如上
使用python2.7.15运行源代码时出现错误:invalid syntax
报错位置出现在
temp = input("不妨猜一下小甲鱼现在心里想的那个数字:")
guess = int(temp)
if guess == 8:
出错原因一:
编码方式为cp9365改为utf-8
出错原因二:
input语句没有加()
出错原因三:
if语句后面丢掉了 ":"
修改后代码截图
运行结果截图:
视频中源代码如上
使用python2.7.15运行源代码时出现错误:invalid syntax
报错位置出现在
temp = input("不妨猜一下小甲鱼现在心里想的那个数字:")
guess = int(temp)
if guess == 8:
出错原因一:
编码方式为cp9365改为utf-8
出错原因二:
input语句没有加()
出错原因三:
if语句后面丢掉了 ":"
修改后代码截图
运行结果截图: