n, m = map(int, input().split())
if n < m:
n, m = m, n
def mod(x,y):
if x % y:
mod(y, x % y)
else:
return y
#or return(y) or return (y)
print(mod(n, m))
I'm try to make recursive function to get greatest common divisor and least common multiple, but the function does not return the variable.
I checked a variable is fine (it's exist well right before return
function) and if statement is also fine but the return()
function does nothing but return None
.
I tried return string (return "what"
) but it still returns None
.
Where is my mistake? And how to make return function returns variable normally?