dictionary - Python : How to pass a value to a variable that is a function...? -


I am new to programming like Python and general in many others. Hope someone can help you.

I have a dictionary:

  dictionary = {'key1': fun1 (), 'key2': fun2 (), ...} Val = dictionary. Get ('key2')  

Now I want to use fun2 () to call val . How do I pass the argument for val ? Assume that fun2 (x, y) ?

What do you want to do here Firstly the brackets from the works in your dictionary have been deleted You need to do this because otherwise you are calling them and the returned value will be stored instead.

After this you can define val first, you should be able to use it as a normal function name because it is now fun2 :

  indicates val (x, y)  

Comments