midterm 1 Flashcards
&= bitwise and
this is equivalent to an intersection (set.intersect()) which keeps only what is common between the source and what you’re comparing it to
Bit 1 Bit 2 Bitwise AND (&)
0 0 0
0 1 0
1 0 0
1 1 1
my_keys &= set(d.keys())
in re
is the or expression, you can seperate different patterns that you want to match using |
dictionary.get()
searches for the key and returns the optional value if it’s not found
keyname Required. The keyname of the item you want to return the value from
value Optional. A value to return if the specified key does not exist.
Default value None
NESTED list comprehension
[expression for outer_loop_variable in outer_sequence for inner_loop_variable in inner_sequence]
.split()
can specify a separator. default is any whitespace