1/19
Looks like no tags are added yet.
how are variables stored in the computer?
every value gets its own space
tracked via a type and ID address in memory
how to print the type of an object?
print(type(x))
mutable? Provide Examples
a variable that you can edit in place.
list, dict, set
immutable. examples?
a type that must be completely replaced to edit it
strings
how to index a string (general form)?
str[start:stop:step]
how to exclude x characters at the end of string?
[:-3]
List
a mutable type, defined with brackets
tuple
an immutable parentheses, immutable object
sets
unorderd collections of objects, mutable, makes things easy to look up
dictionaries
map a key to a value to look it up curly brackets {}, “a”: 4
the stack
where we keep track of our frame and the data that goes with them
stack frames
keep trak of the data associated with a particular frame cellhow
How do stack frames work with functions?
when a function is called, a new stackframe is opened. When the function returns, the stackframe closes
how are mutable objects passed into a function?
they are passed as references
idiom
values treated as false (empty list)
what is map
a way to create a new list by calling a function to transform each element
higher order function
a function takes at least one function as a n arguement or that returns a function as a result (or both)
what is ord(c )
turns a character into an ordinal (non-negative counting number) —> encoding
what is chr(n)
turns an integer into a character —> decodingW
what is the form for a blank matrix
[[x for x in sublist ] for sublist in matrix]
[[col for col in row] for row in matrix]