Hi, I have this simple function that uses a dictionary to choose which function to be executed. In the default argument of the get method, there is a string (“Invalid month”). This does not correspond to any function. So it is a string. But what if func = “Invalid month”. Then why does print(func()) print invalid month. print(“Invalid Month”()) doesn’t seem right. It’s a string and has the syntax of a function? Can someone please explain this to me. Thanks.
Also, if you had
def f(): print(4) variable = f
Why does f() and variable() do the same thing. How can a variable that holds a function have the syntax of a function.