I have been working on a project, and to test If/Elif/Else projects, I wrote a little bit of code to get an idea how it worked. I wrote:
opclo = input('>');
if(opclo == 'CLOSED'):
print "Good night.";
elif(opclo == 'WACKED'):
print "wacked";
else:
print "Good morning.";
It gives me this error:
Traceback (most recent call last):
File "python", line 2, in <module>
File "<string>", line 1, in <module>
NameError: name 'CLOSED' is not defined
I am wondering why it does this. I have tried mutliple things, such as removing brackets, adding a opclo = opclo2
(making line 1's opclo
into opclo2
) and adding a array with "CLOSED"
and "WACKED"
in it. Any ideas?
Thanks.