1. Python - Functions
Function Syntax
def functionname(args,args):
do something
def functionname(arg,arg):
do something
return
Functions with Optional Args:
def functionname(VAR="hello"):
print("HEY",VAR)
// calling functionname(VAR="NOTHELLO) or functionname("NOTHELLO") overrides the VAR
Docstrings // descriptions to explain function
def functionname():
"""this is a description.
>>> test
"""
// use help(functionname) to get description
Placeholder line
def functionname():
pass // placeholder
Comments
Post a Comment