Module 6 Flashcards
what are local variables ?
Local variables are any objects that have been created within a function and only exist inside the function where they are made.
What is a local environment ?
Code within a function is described as a local environment.
purpose of local variables
they cannot be accessed from anywhere outside the function
global variable
variables created outside any function
List the 4 main sections of a numpy format docstring
The NumPy format includes 4 main sections:
- A brief description of the function
- Explaining the input Parameters
- What the function Returns
- Examples
how to read the docstring for the len function ?
?len
What happens when you implement defensive programming ?
Code written in such a way that if errors do occur, they are handled in a graceful, fast and informative manner.
What do you mean by raising an exception ?
we are forcing our own error with our own message.
Name some types of exception
valueError and typeError