Creating functions
Introduction to Functions
The help function:
help(print) # You can pass any other function to the help function and this will provide you with info about that particular function
# You just add the name of the functionThis shows arguments
Provides info of what the function does
The print function:
# A function does something
print(args) # You pass to a function argumentsCreating your own function:
You define functions with the word def
# Defining the function:
def greet_person():
print("Hello there, this is a greeting...")
# Calling the function:
greet_person()Calling function instances with args:
To do a more personalized greeting:
Adding a default argument to the function:
This is used when an arg is not passed to the function
Adding and documenting functions in a prod environment:
When you are defining a function the value is a
ParameterWhen you are calling a function the value is a
Argument
Last updated