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

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 179
    Comment on it

    In return statement return exits a function, optionally passing back an expression to the caller and value. A return statement with no arguments is as same as return None and function. For example you can see below example for return statement.

    # 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( 40, 30 );
    print "Outside the function : ", total 

    Output:

    Inside the function : 70
    Outside the function : 70

 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: