0
Need some help
there is a "return" in my code but it doesn't output anything https://code.sololearn.com/cIJVGnv6Fm7h/?ref=app
5 Answers
+ 2
hmm maybe that's because return isn't supposed to output a value but give the function a value back when it's called!Try reading the Python sololearn course.
+ 1
Because you aren't using any print. print(GCD(int(A),int(B)))
+ 1
example:
def add(x,y):
a=x+y
return a
add(4,5) - This would return 9 and do nothing with it.
num=add(4,5) - This would set the variable "num" to a value of 9 as 9 is returned from the function
print(add(4,5)) - This would print whatever is returned from the function
Return is simply what information you get back from the function. What you so with that is up to you.
Return = The info sent back from the function
Print = output to the screen
0
well I did.
what should I change to make it work?
0
đ thanks. in fact the problem is that i dont undestand wats the difference between return and print