0

Is using return in python functions necessary?

Is using return in python functions necessary? And If we don't use it what happen ?

2nd Mar 2021, 6:48 AM
A.R.T
A.R.T - avatar
3 Answers
+ 4
In python, there's no requirement to use function return. Your function can just print the output to the screen. However, it is usually a good practice to return something from the function (so that it's easier to catch bugs) and then you can use it or discard it depending on your needs.
2nd Mar 2021, 6:57 AM
Abir Hasan
Abir Hasan - avatar
+ 3
Without a return statement, the function returns None.
2nd Mar 2021, 7:44 AM
Per Bratthammar
Per Bratthammar - avatar
+ 1
Abir Hasan thank you so much
2nd Mar 2021, 7:07 AM
A.R.T
A.R.T - avatar