Return Keyword in Python with Example Program

 Definition of the Return Keyword:

  • The return keyword is used in a function to send a result back to the code that called the function.


Syntax of return:

def function_name(parameters):

    # Code

    return value


Simple Example of Using the return Keyword:

Question :

Write a function add() that returns the sum of two numbers. Then, display the result.

Program:



Post a Comment

0 Comments