我在运行Python 3.5.0的Windows 8中遇到了流程图问题 当我运行程序时没有错误消息,但是当我输入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')
答案 0 :(得分:0)
答案非常简单,你写了
* {
box-sizing: border-box;
margin: 0px;
padding: 0px;
}
body {
font-family: Sans-Serif;
}
.wrapper, footer {
width: 100%;
}
.content {
margin: 0 auto;
height: 1000px;
width: 90%;
}
footer {
background-color: #333;
}
.copyright {
padding: 20px;
}
.copyright p {
color: #fff;
display: inline-block;
padding: 0px 20px;
}
.copyright p:last-child {
float: right;
}
显然你的意思是
if fly == 'Y':
print('You have chosen no')
要找到这种拼写错误,请不要犹豫,在代码中添加if fly == 'N':
print('You have chosen no')
语句,或者将代码解释为一些橡皮鸭,这真的有帮助!