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:*
- We can define multiple functions in one Python file.
- We can call any defined function.
- A function must be defined before it is called during normal execution.
- 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.