I had a problem with a simple program that I wrote, I want to execute a specific function according to user input. I already used the dictionary as a replacement for the switch for assignment, but when I try to assign functions to the dictionary, it does not execute them ... Code:
def PrintValuesArea():
def PrintValuesLength():
def PrintValuesTime():
PrintTables={"a":PrintValuesArea,"l":PrintValuesLength,"t":PrintValuesTime}
PrintTables.get(ans.lower())
What have I done wrong? It looks the same as all the examples I've seen ...
source
share