0

I'm created this to convert binary number to decimal number. But it give wrong output. How can I make this work properly ?

https://code.sololearn.com/cpTX3H4Dc3Ya/?ref=app

3rd Nov 2018, 6:59 AM
Vinod Damunupola
Vinod Damunupola - avatar
5 Réponses
+ 1
Yes, x[z] is basicly an str, and since the input are 0 and 1 which is a number, sure
3rd Nov 2018, 7:45 AM
Taste
Taste - avatar
+ 1
Convert x[z] to int forst before doing any checking or calculation with other int And x[z:z+1] you can simply use x[z]
3rd Nov 2018, 7:27 AM
Taste
Taste - avatar
+ 1
replace x[] to int(x[])
3rd Nov 2018, 7:35 AM
Taste
Taste - avatar
0
where can i do that change
3rd Nov 2018, 7:30 AM
Vinod Damunupola
Vinod Damunupola - avatar
0
are you sure [] works with int?
3rd Nov 2018, 7:44 AM
Vinod Damunupola
Vinod Damunupola - avatar