How to Return a Value from a Function in Python


In this example we will show how to let a function return a value in Python.

Source Code

def my_function(x, y):
    return x + y

print(my_function(1, 3))
print(my_function(5, 10))

Output:

4
15
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments