Vote count:
0
Suppose there is a list(or an array) which contains 1s and 0s.
gona = [1, 0, 0, 0, 1, 1]
I want to convert this into the integer represented by the binary value 100011 (The number made out of the elements in the list).
I know that this can be done as follows.
int("".join(map(str, gona)),2)
or
int("".join([i for i in gona]),2)
Is there any other faster way to do this?
asked 1 min ago
Aucun commentaire:
Enregistrer un commentaire