how to return a value from a function in python

def func():
	a = 10
	return a

print(func())
>>> 10

Here is what the above code is Doing:
1. Defining a function called func.
2. Creating a variable called a and assigning it the value of 10.
3. Returning the value of a.
4. Calling the function func and printing the return value.

Now let’s look at a more complicated example:

def func():
a = 10
b = 20
return a + b

print(func())
>>> 30