0

return from a function

Can anyone please explain more on return, I can't seem to get it right

15th Mar 2022, 9:23 PM
Oyebode Omobolaji
Oyebode Omobolaji - avatar
2 Answers
+ 3
For example, you have a function that adds two variables A and B: add(A, B). Within this function, you have the mechanisms which adds the two variables but then you have to return it from this function so it can be used elsewhere
15th Mar 2022, 9:46 PM
rafalzacher1
0
def multiply(a,b): return a * b print(multiply(4,10)) console prints 40
16th Mar 2022, 1:47 AM
madeline
madeline - avatar