3
NameError problem
jasonpark (2)

The output says that I have a NameError: name 'month' is not defined. But I'm pretty sure it is returned from the function "get_filters()". What am I doing wrong here? Thanks in advance to all that help.

You are viewing a single comment. View All
1
leon332157 (55)

@jasonpark So split the question into two parts, first, if you want to make a variable from a function global, you can use the global keyword at the start of the function, like
def fun():
.global name
.name=input('name')

and the second part is, the value functions returns can be the same name as your variable outside of the function, but returning the variable inside of the function will not change the variable outside of the function unless the variable is a global variable, when a variable is global, you can change it in the function, no need for return.