coding shortcuts Flashcards

(3 cards)

1
Q

how to find the hex of a number

A

hex(ord(letter))[2:]

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

how to convert list of tuples to tiples

A

repr(name)[1:-1]

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

how to check for consecutive numbers

A

return all(a[i] - a[i - 1] == 1 for i in range(1, len(a)))

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