Relative Content

Tag Archive for pythonpython-3.x

why is my python3 code logic not working?

i am trying to build a program that takes a list for example [9,9,9] and adds one to it so as to return [1,0,0,0] so it treats the list as a whole number so [9,9,9] would be like 999+1=1000 so it returns [1,0,0,0] but my code keeps on returning [9,10,0]
here is the code(python 3):

why is my python3 code logic not working?

i am trying to build a program that takes a list for example [9,9,9] and adds one to it so as to return [1,0,0,0] so it treats the list as a whole number so [9,9,9] would be like 999+1=1000 so it returns [1,0,0,0] but my code keeps on returning [9,10,0]
here is the code(python 3):

why is my python3 code logic not working?

i am trying to build a program that takes a list for example [9,9,9] and adds one to it so as to return [1,0,0,0] so it treats the list as a whole number so [9,9,9] would be like 999+1=1000 so it returns [1,0,0,0] but my code keeps on returning [9,10,0]
here is the code(python 3):

why is my python3 code logic not working?

i am trying to build a program that takes a list for example [9,9,9] and adds one to it so as to return [1,0,0,0] so it treats the list as a whole number so [9,9,9] would be like 999+1=1000 so it returns [1,0,0,0] but my code keeps on returning [9,10,0]
here is the code(python 3):