python - Again, 'return' outside function -
i'm trying write module calculates least common multiple, same error: 'return' outside function
def lcm(x,y): amin = min(x,y) j in range(1, amin + 1) : if(x%j==0 , y%j==0) : jmax = j z= (x*y)/(jmax) return z i tried indent return line, it's indented @ same level if, don't know do.
the function body needs indented:
def lcm(x,y): amin = min(x,y) j in range(1, amin + 1) : if x%j==0 , y%j==0 : # also, no need use parentheses there jmax = j z= (x*y)/(jmax) return z
Comments
Post a Comment