Here is my code:
def funcWithParam(param):
print "Your parameter is: " + param
def justFunction():
print "No parameters"
def wrong():
print "wrong choice"
userInput = raw_input("type 'params' for parameters. type 'no' for no parameters: ")
if userInput == "params":
myparam = "type your parameter: "
else:
myparam = ""
dic = {
"params": (funcWithParam(myparam)),
"no": justFunction,
}
dic.get(userInput,wrong)()
I know the code is wrong and every time I run it, the "params" key is being executed with the "userInput" string. If at the param check is True and I add a 2nd argument then the program fails saying:
'NoneType' object is not callable.
I wonder what is the correct syntax / way to call a function with parameters using a dictionary.