(Apr-26-2019, 06:00 AM)JohnKentzelGriffin Wrote: Is this more like what you want?
function_dictionary = {'fun1':lambda a:a*a, 'fun2': lambda a:a+a} print function_dictionary['fun1'](3) # prints 9 print function_dictionary['fun2'](7) # prints 14
what if i have 85 functions to put in there, except on Tuesday only 84?
(Apr-26-2019, 06:34 AM)DeaD_EyE Wrote: Python is very flexible.
indeed, it is. but some people discourage doing some things certain ways.
do you like this way of making a dictionary?
fun_stuff = dict( identity = lambda x:x, square = lambda x:x*x, cube = lambda x:x*x*x, )
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.