首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >运行Python 3.5.0的Windows 8中的流程图

运行Python 3.5.0的Windows 8中的流程图
EN

Stack Overflow用户
提问于 2017-08-13 08:21:49
回答 1查看 39关注 0票数 0

我在运行Python 3.5.0的Windows8中有一个流程图问题,当我运行程序时,没有错误信息,但当我键入no时,程序执行输入为yes,您可以帮助我解决这个问题。

代码语言:javascript
复制
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')
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-08-13 12:40:47

答案很简单,你已经写过

代码语言:javascript
复制
if fly == 'Y':
    print('You have chosen no')

显然你的意思是

代码语言:javascript
复制
if fly == 'N':
    print('You have chosen no')

要找出这种类型的拼写错误,请毫不犹豫地在代码中添加print语句,或者大声向某个橡皮鸭解释代码,这真的很有帮助!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45656042

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档