0
why if I am adding values to a list and a type error occurs the last value it prints twice
2 Réponses
+ 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??