Create Your Own


#1



Create Your Own


It says that vegetables is not defined.


I'm expecting it to work, but I'm getting an error message that says name 'vegetables' is not defined.

How do I get this to work? What am I doing wrong?


vegetables = ['carrot','broccoli','asparagus','peas']

for vegetable in vegatables:
    if vegetable == 'carrot':
        print orange
    else:
        print green
else:
    print 'I like vegetables!'


#2

Check your spelling.

Should those be strings?


#3

Thank you very much!


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.