Defining a function in Python and returning a value.
- Steven Belanger
- Oct 23, 2021
- 1 min read
In order to define a function, your function block should begin with the defkeyword. This would then be followed by the function name with added double parentheses "(())". Inside the parentheses, you would place your parameters or arguments. End your first line of function with a colon ":". The keyword returnwould be used to return a value from a function. Example:
def printme( str ):
"This prints a passed string into this function"
print str
return
Comments