【问题标题】:flow chart in Windows 8 running Python 3.5.0运行 Python 3.5.0 的 Windows 8 中的流程图
【发布时间】:2017-08-13 00:21:48
【问题描述】:

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

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')

【问题讨论】:

    标签: python windows flowchart


    【解决方案1】:

    答案很简单,你写过

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

    你的意思很明显

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-26
      • 1970-01-01
      • 2018-04-08
      • 1970-01-01
      • 2013-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多