Skip to content
CodeItRaw
Code Reading
/
Binary to Decimal
Path
Play
Daily
Leaderboard
tr
Break the Code
Binary to Decimal
Write a text for which this function gives the wrong answer.
1
def
to_number
(bits):
2
value =
0
3
for
i
in
range
(
len
(bits)):
4
if
bits[i] ==
"1"
:
5
value +=
2
** i
6
return
value