how to call 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: create function in python
def myFunction():
print('I am running in a function!')
Example 3: how to define a function in python
def function_name():
pass
Example 4: explain def in python
def greet(name):
"""
This function greets to
the person passed in as
a parameter
"""
print("Hello, " + name + ". Good morning!")