0 points

How to use of “return” keyword in a function


dashboard

Tue Mar 31 2020 05:43:21 GMT+0000 (UTC)

Posted by @EnjoyByte #python #function #returnfunction

#define a function 
 1.Def cube(num)
      #write the formula of cube
      2.return num*num*num
     #give the number to calculate the cube 
     3.cube(3)
   # print the cube of that number simply by using print command
    4.print(cube(3))
     5.“return” keyword means that function have to return value         
content_copy Copy

return is the keyword that this program has to return value. A return statement ends the execution of a function call and "returns" the result the value of the expression following the return keyword, to the caller. If the return statement is without an expression, the special value None is returned.

https://www.youtube.com/watch?v=rfscVS0vtbw&t=5s