Thanks G-Do! I think you gave me a good hint where i went wrong. Here is my error prone code:

# a dictionary of functions by bumsfeld
# get errors = TypeError: 'int' object is not callable
def add(a, b):
return a + b
def sub(a, b):
return a - b
def mul(a, b):
return a * b
def div(a, b):
return a / b
a = b = 1
mathD = {
'+' : add(a, b),
'-' : sub(a, b),
'*' : mul(a, b),
'/' : div(a, b)
}
f = mathD['+']
print f(99, 13)

G-Do did give you the hint, don't call the functions from the dictionary, just reference them. I took the liberty to play with your code a little ...

def add(a, b):
return a + b
def subtract(a, b):
return a - b
def multiply(a, b):
return a * b
def divide(a, b):
if b == 0:
print "divide by zero error"
else:
return a / b
# use the function reference, not the actual call
mathD = {
'+' : add,
'-' : subtract,
'*' : multiply,
'/' : divide
}
f = mathD['+']
print f(99, 13)
# or simpler ...
print mathD['+'](99, 13)
# maybe less cryptic ...
def calc(math_op, a, b):
return mathD[math_op](a, b)
# now you can use ...
print calc('/', 355, 113.0)

That is not necessarily the OP's actual question,
(does not even have a dictionary of functions)
but I was facing the problem that I needed something like the calc function
that vegaseat suggested and this is what I came up with:

Hi guys, I'm playing around ith optionals a little, but I'm not surewhether this is the correct behavious as I'm getting a null pointer exeption (I thought the point of ...

Hi
I Currently working on a project to schedule installers to do installations.
When scheduling the user will select the day of intall and if the number of days the ...