The Student Room Group

Computer Science Python programming

What does return mean in Python. Does it mean output
if you're in a procedure that gives back an answer like if you had a procedure which you entered two numbers into and it calculate the sum of them, then you have to tell it to return that answer

e.g.

def multiply (x, y):
answer = x*y

return answer

this = multiply(3, 4)
print(this)
that = multiply(5, 6)
print(that)


which would output
12
30

Quick Reply

Latest