-3
我在互联网上进行了研究,我无法找到明确的答案来解决我的问题。字典值可以分配给本地函数吗?例如:字典值可以对应/分配给一个函数吗?
def add(x, y):
sum = x + y
return sum
dictionary = {'add' : add} # Will this value represent the add function?
任何建议,将不胜感激! :)
当您尝试时发生了什么? – wwii
'return sum([x,y])'会和你的函数一样或者更简单地'return x + y' –