Python Flashcards
What are the two modes you can run Python on?
Standard and interactive mode.
What environments does Anaconda uses?
Jupyter and Spyder
What are the three charactestic of each object in Python:
1) Type: determines the operations it can support
2) Value
3) Identity: an identity number for the object.
Each object has attributes (separated by dot, data attribute (value) or methods (functions)).
What is an instance?
An occurrence of an object
x.shape: (a data attribute)
Give you the amount of elements in an array.
How do you distinguish from data attribute and method?
Method is followed by parentheses x.mean()
What happens when you run the import statement
1) Create a new namespace for all the objects in the module
2) Execute the code of the module and run it in the new namespace
3) Creates a name for referencing the new namespace.
dir(str):
Give the list of methods for the object in question
True or False
True
True and False
False
What is a sequence in python?
A collection of objects in order (list, tuple, range)
Why are list methods “In place” methods?
They modify the original list, they do not return a new list.
What is polymorphism in python?
The operator ouput depends on the type of object it is applied to (think addition between string vs addition between numbers, a plus sign between string means concatenation).
What is the span of a pair of vector?
It is the set of all their linear combinations.
What does it mean that two or three vectors are linearlydependent?
One of them is redudant, you could remove one of them without reducing the span of the vectors (in other word they are sitting on the same line or on the same plane in 3D)