When I create a variable and get user input, the program stops until it gets an input from the user. So what I did is I define a function and call it on condition. Now the problem I'm facing is I cannot access the input provided by the user. It says the "VarName" is not defined. I can see it but inside the function.
code example :
def math():
add = input("Enter value here : ")
math()
print(add)
How do I process the input value? Put it in a variable and use an if statement on a condition using that variable.
Updated question :
I'm having two functions. One gets user input on condition A and the second one gets input on condition B. So only one of them is needed to be shown in the program at a time. This works properly until other place where I want to get the value of the input.
When I try to do return x() and print(y()).. it is calling the function and it is asking for input two times where only one time is needed.
Please tell me how I get the input value without making the program to ask for an inpu.