+ 1
What's wrong with the code?
#Enter: 1010101100 sys_znach = input() list_znach = list(sys_znach) len_znach = len(list_znach) - 1 my_array = [] count = len_znach i = 0 while i != len_znach: while count != 0: sys_x2 = int(list_znach[i])*(2**count) my_array.append(sys_x2) count -= 1 i += 1 print("Des system:",int(sum(my_array))) It must convert the id of the binary system to decimal.
2 Réponses
0
If you try in English maybe you could get more help
- 1
While I don't know py, your inner loop only executes once as count becomes 0 during it's first pass and never changes.