In Python, return and yield are two ways to send a value back from a function or generator to its caller, but they work in different ways.
return is a statement that immediately terminates the execution of a function and returns a value to the caller. When the function is called again, it starts executing from the beginning.
Here's an example:
def square(x):
return x * x
result = square(5)
print(result) # Output: 25