The problem is that you're not storing functions in your dict, but rather the return values of those functions: When you write quick()
, you're calling the function. Your dict ends up looking like this:
suffix = {"quick": None, "strong": None}
What you want to do is to store the functions themselves in the dict like so:
suffix = {"quick": quick, "strong": strong} # no parentheses!
This gives you a dict with two function objects inside. You can now take one of the functions out of the dict and call it:
func = suffix.get("quick")
func()
And just like that, your code will work correctly.
def start():
suffix = {"quick": quick, "strong": strong} # no parentheses!
func = suffix.get("quick")
func()
start() # output: dex is 1
If you need to associate some arguments with the functions in the dict, take a look at this question.