Functions Flashcards
A block of code designed to perform a specific task
Function
Every function contains two pieces - what are they called?
Header & body
What does the keyword ‘return’ tell Python?
We are about to exit a function
A header specifies what?
Name of function & its arguments
The body specifies what?
The work that the function does
Every function header begins with what?
def
For every function, the parenthesis enclosing the function argument(s) must be followed by what
A colon :
Every line of code must be indented by how many spaces?
Four
What is the final line of code called?
Return statement
Running the function is the same as saying what?
Calling the function
What is the goal when coding?
Write as little as possible
What function would you use if you forgot what something does?
Help()
e.g help(round)
When you write a function and provide a description what is that called?
Docstring
When you call help() on a function, what will it show?
Docstring
Good programmers use what?
Docstrings