I'm attempting to run these simple lines of Python code:
myName = input("What is your name?")
print (myName)
if (myName == 'Omar'):
print ("Omar is great!")
else:
print ("You are ok")
It runs okay if I run it using IDLE, but once I put it in a text file with a ".py" extension I get the following output and error:
What is your name?omar
Traceback (most recent call last):
File "hello.py", line 2, in <module>
myName = input("What is your name?")
File "<string>", line 1, in <module>
NameError: name 'omar' is not defined
I don't know the error states that 'omar' needs to be defined, even though 'omar' is simply a string input.
Help would be much appreciated, thanks.