Other answers have covered a lot.. I would just like add some thoughts to it.
First of all your function name input is overriding the python builtin function
so first of all
def my_input():
return input("Enter hours worked: ")
print my_input()
This should suffice.
Concept:
Now if you are using Python 2.X version then there is no need for eval.
input(): Python by default evaluates the input expression if it is recognized by python.
raw_input(): Here the input is taken as a string which needs to be evaluated.
In case of Python3.x:
input() behaves like raw_input() and raw_input() is removed.
So your code should be
def my_input():
return float(input("Enter hours worked: "))
print(my_input())
It is safer and better way to take inputs and also tells us why eval is not recommended.
You don't know what's gonna come through that door.
Thank you.
def input()eval()for this.int()orfloat()will probably work for you.eval()is extremely dangerous to use with user input. eg try enteringhelp(__import__('os').removedirs)