def my_sum(x, y):
sum = x + y
return sum
my_sum(1, 2)
Hi all , i am trying to call this function, but this function cannot return the result for some reason, my i know why ?
Many thanks !
def my_sum(x, y):
sum = x + y
return sum
print(my_sum(1, 2))
Note that you need to do something with the return value, as shown above. The function is returning, but since you don't use the value, it's just discarded.
You can also assign it to a variable name.