What i want to do is have a function which checks some conditions and assigns a value according to which condition is true. But the variable assignment in the function does not affect the value outside. (Scopes)
While the following code won't work, is there any way to not have to write the if-elif block again and again?
def calc():
if o==1:
z=x+y
elif o==2:
z=x-y
calc()
print(z)