Week 4 Flashcards
How do you prevent logic/runtime errors?
Write tests
What three things should names convey?
- Effect
- Behavior
- Value
What is a function docstring?
A string that provides documentation about the functions purpose, parameters, return values, etc.
What is a function specification?
A function signature plus docstring
How do you uninstall a library?
pip uninstall library_name
How are command-line arguments returned?
As a list of strings
What are typical variable names for real numbers?
x, y, z
What are typical variable names for functions?
f, g, h
What are typical variable names for integers?
n, k, i
What types of errors are the easiest to find?
Syntax
What does typing cat -A filename.py in the terminal do?
Show tabs and spaces
What does the getattr method do?
Returns the value of an attribute of a specific object/instance.
What does the hasattr method do?
It checks if the object has a specific attribute
What does the type method do?
It gets the type of an object
How are class names formatted?
Snake title case