vendredi 16 juin 2017

"Good Day" script

I have just started working with python, and I can't seem to get this script to work:

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 + '!'  

It works fine until you answer this line:

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

After this it says:

Traceback (most recent call last):  
  File "/Users/mtreadwell/Desktop/getage.py", line 8, in <module>  
    if good_day == Yes :  
NameError: name 'Yes' is not defined  

Please help fix this error!

Aucun commentaire:

Enregistrer un commentaire