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:

I am having a trouble not knowing how to do a java code that will take user string then encrypt it using Elgamal algorithm as following
Elgamal algorithm Pseudo code: ...

A few weeks ago my laptop browsing and windows apps error. When i am on my facebook account i can watch youtube videos posted on feeds but other videos pos ...