下面的 python 代码不是正确缩进了吗?
Isn't the python code below, properly indented?
这是我做的一个小游戏。规则简单,玩家必须确定自己心中的数字。我稍后会导入随机模块。
print('Hello!, What is your name?')
userName = input()
print(myName + 'Welcome to Guess it! Ralph')
print('You must guess the number that I have in my mind(from 1 to 10) within 5 chances')
myNumber = 3
print('Give your prediction')
for no_of_chances in range(5, 0, -1):
usersPrediction = input()
我在 pycharm 中 运行 时遇到此错误:
如果 usersPrediction < myNumber:
^
IndentationError:意外缩进
if usersPrediction < myNumber:
print('It is lower than required,try a higher value')
elif usersPrediction > myNumber:
print('It is higher than required,try a lower value')
elif usersPrediction == myNumber:
print('yahoo!, you did it')
print('You always have a next chance, try it again')
缩进print('yahoo!, you did it')
这是我做的一个小游戏。规则简单,玩家必须确定自己心中的数字。我稍后会导入随机模块。
print('Hello!, What is your name?')
userName = input()
print(myName + 'Welcome to Guess it! Ralph')
print('You must guess the number that I have in my mind(from 1 to 10) within 5 chances')
myNumber = 3
print('Give your prediction')
for no_of_chances in range(5, 0, -1):
usersPrediction = input()
我在 pycharm 中 运行 时遇到此错误: 如果 usersPrediction < myNumber: ^ IndentationError:意外缩进
if usersPrediction < myNumber:
print('It is lower than required,try a higher value')
elif usersPrediction > myNumber:
print('It is higher than required,try a lower value')
elif usersPrediction == myNumber:
print('yahoo!, you did it')
print('You always have a next chance, try it again')
缩进print('yahoo!, you did it')