Windows 8 运行 Python 3.5.0 中的流程图

flow chart in Windows 8 running Python 3.5.0

我在 Windows 8 运行ning Python 3.5.0 中遇到流程图问题 当我 运行 程序没有错误消息但是当我输入 No 时程序执行输入为 yes 你能帮我解决这个问题吗。

print('Hello, do you want to play a game')
print('Great lets play a guessing game')
print('Think of an animal and I will ask you')
print('different questions to try to guess your animal')
print('Press Y for yes and N for no')
fly = input('Question #1 Can your animal fly?')
if fly == 'Y':
    print('You have chosen no')
bird = input('Question #2 Is your animal a bird?')
if bird == 'Y':
    print('Yay I win')
elif fly == 'N':
    print('Question #2 Can your animal swim?')
elif bird == 'N':
    print('Does your animal live on land')

答案很简单,你写了

if fly == 'Y':
    print('You have chosen no')

显然你的意思

if fly == 'N':
    print('You have chosen no')

要找到这种打字错误,请毫不犹豫地在您的代码中添加 print 语句,或者向橡皮鸭大声解释您的代码,这真的很有帮助!