dhow to write a def in python code example
Example 1: python functions
# first we have to write 'def'
# then our function name followed by ()
# and a ':' abd defining block of code
def multiply(): # naming convention could be same as variable for functions
product = 10.5 * 4
return product
product = multiply()
print(product)
Example 2: how to define functions in python
def add(number):
equation = 5 + number
print(equation)
add(10)
output:
15