0
why if I am adding values to a list and a type error occurs the last value it prints twice
2 Answers
+ 1
If an error occurs the code statement will jump into the except clause without reassigning x to a new valueā¦
In the next iteration of the loop when x is added to the list, the old value is added (again)
To change that, you should reorder the input meachanism and the list.append, such that there will only be something appended to the list, if a new valid input was received
0
What are you trying to do??