midterm 1 Flashcards

1
Q

&= bitwise and

A

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())

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

in re

A

is the or expression, you can seperate different patterns that you want to match using |

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

dictionary.get()

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

NESTED list comprehension

A

[expression for outer_loop_variable in outer_sequence for inner_loop_variable in inner_sequence]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

.split()

A

can specify a separator. default is any whitespace

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly