In python 2, "input" takes what you enter, and tries to treat it like a python expression. So it treats your string "alex" as the name of a variable. If you do not have a variable named "alex", it creates an error trying to look for it. Here's an example
alex = "Hello world"
x = input()
print x
If I enter "alex" in the input, this will print "Hello world." If you want to take a string as input instead, use raw_input().
alex = "Hello world"
x = raw_input()
print x
This would print "alex", not "hello world."
If you are using python 3, "input" behaves the exact same way as "raw_input" does in python 2. I just ran your code in python 3 and did not get any error, so you are probably using 2.
Also, here is more info about input and raw_input.