DEV Community

yugalakshmi
yugalakshmi

Posted on

Functions in Python-6

9. Return Statement

The return statement is used to send a result from a function back to the calling code.

Example:
def add(no1, no2):
return no1 + no2

result = add(10, 20)
print(result)
Output:
30
Here, return sends the result back to the function call.

***Important Points:*

  1. We can define multiple functions in one Python file.
  2. We can call any defined function.
  3. A function must be defined before it is called during normal execution.
  4. If we define the same function name again, the latest definition replaces the previous one.**

Conclusion
Functions are an important concept in Python. They help us divide large programs into smaller tasks, reuse code, and make programs easier to understand and maintain.

Top comments (0)