A function is a block of code which only runs when it is called. You can pass data, known as parameters, into a function. A function can return data as a result.
In Python a function is defined using the def keyword:
def my_function():
print("Hello from a function")- 0-sum.py - Write a function that returns the addition of 2 integers.
- 1-power.py - Write a function that returns the power of 2 integers.
- 2-temperature.py - Write a function that converts a temperature from Fahrenheit to Celsius.
- 3-string.py - Write a Python function called reverse_string that takes a string as input and returns the reverse of that string.
- 4-fibonacci.py - Write a function that returns the nth Fibonacci number.
- 5-prime.py - Write a function that checks if a number is prime.
- 6-password.py - Write a function that validates password.