Python Flashcards
1
Q
inline if
A
print a if b else 0
2
Q
how to write inline dictionary init or update. element
A
hash_map[char] = hash_map[char] + 1 if char in hash_map else 1
3
Q
how to get the values of dictionary?
A
mp.values(), and it return a list of all the values.
4
Q
!= vs not
A
not is a logic operation that convert the bool value
!= check if left not equal to right