 # Python Values Return and Recursion :

### Function Return Values :

To let a function return a value, use the return statement :

#### Example :

 ``` def my_function(x): return 5 * x print(my_function(2)) print(my_function(4)) print(my_function(6)) print(my_function(8)) print("\n python function return example :) ") input() ```

#### Output : ### Recursion :

Python also accepts function recursion, which means a defined function can call itself. Recursion is a common mathematical and programming concept. It means that a function calls itself. This has the benefit of meaning that you can loop through data to reach a result.

The developer should be very careful with recursion as it can be quite easy to slip into writing a function which never terminates, or one that uses excess amounts of memory or processor power. However, when written correctly recursion can be a very efficient and mathematically-elegant approach to programming.

#### Example :

 ``` #find factorial number using recursion function def my_function(n): if n == 1: return n else: return n*my_function(n-1) num = int(input("Enter a number: ")) # take input(int type) from the user if num < 0: # check is the number is negative print("Sorry, Factorial does not exist for negative numbers.") elif num == 0: print("The factorial of 0 is 1") else: print("The factorial of",num,"is",my_function(num)) input() ```

#### Output : 