Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • The return Statement in Python

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 314
    Comment on it

    The return statement indicate that return exits in a function and optionally pass back an expression to the caller variable and return statement with no arguments is the same as return None variable.
    For example you can see below code and try it.

    # Function definition is here
    def sum( arg1, arg2 ):
       # Add both the parameters and return them."
       total = arg1 + arg2
       print "Inside the function : ", total
       return total;
    
    # Now you can call sum function
    total = sum( 15, 30 );
    print "Outside the function : ", total 
    Output- Inside the function :45
    Outside the function :45
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: