+ 3

What is 'return' in python?

Sometimes we use return in python which works like print. But my question is that what is the difference between the both? What is the significance of return than print()?

13th May 2020, 8:32 AM
Md. Faheem Hossain
Md. Faheem Hossain - avatar
2 Answers
+ 9
Using return you can store the value from function in a variable and use it somewhere else in the code If you use print you can't store the functions result in a variable and you have to call the function everytime
13th May 2020, 8:36 AM
Abhay
Abhay - avatar
+ 3
You should also use the search bar in sololearn app, as this question was asked frequently in the past. Thanks!
13th May 2020, 9:15 AM
Lothar
Lothar - avatar