It seems that return is not working:
def hello(x,y):
return x
return y
I can't seem to return y why is this happening. I am beginner so sorry if this seems dumb to you.
Instead of returning x
and then y
, how about you return them both? return x, y
.
After a return statement you leave the function.
Here is how you would return 2 values and call them. Return x immediately exits the function and you won't return y.
def hello(x,y):
return x,y
x,y=hello(1,2)
print(x,y)