"美好的一天"脚本

时间:2017-06-16 19:19:04

标签: python if-statement

我刚刚开始使用python,我似乎无法使用此脚本:

$('#selector')

在你回答这一行之前一切正常:

name = input('Enter your name in quotes: ')  
print 'Hello,' + name +'!'  
age = input('Please enter your age with no quotes: ')  
print 'Hi again, ' + name +'! I see you are' ,age, 'years old.'  
color = input('What is your favorite color, in quotes? ')  
print 'I like the color ' + color + ' too, ' + name + '!'  
good_day = input('Are you having a good day? Type "Yes" or "No" ')  
if good_day == Yes :  
    print 'That is good, ' + name + '!'  
else :  
    print 'I hope your day gets better, ' + name + '!'  

在此之后它说:

good_day = input('Are you having a good day? Type "Yes" or "No" ')

请帮助解决此错误!

1 个答案:

答案 0 :(得分:2)

if good_day == Yes :

Yes是你的问题。它应该是字符串"Yes"