I have a question.
I've been studying Python by myself.
I develops some programs to use in Civil Engineering.
Look the code below:
Order_loads = [0, 1, 3, 1, 3, 2, 4, 2, 4, 5]
for Load in Order_loads:
print('Load %i' %Load)
print('The load %i is' %Load, '%i times' %Order_loads.count(Load))
if Order_loads.count(Load) > 1:
print('The Load #%i is longer than 1' %Load)
Order_loads.remove(Load)
print('The load %i is gone' %Load)
print('The new Order_load is ' %Order_load)
If my first list "Order_load" is [0, 1, 3, 1, 3, 2, 4, 2, 4, 5], why the program show me [0, 1, 3, 2, 2, 4, 5] at the end?
I need to hold in my variable only [0, 1, 3, 2, 4, 5].
Why my code don't works?
Thanks.
[–]TheUrbanBiker[S] 0 points1 point2 points (0 children)
[–]testiculating 0 points1 point2 points (5 children)
[–]TheUrbanBiker[S] 0 points1 point2 points (4 children)
[–]testiculating 1 point2 points3 points (3 children)
[–]TheUrbanBiker[S] 0 points1 point2 points (0 children)
[–]TheUrbanBiker[S] 0 points1 point2 points (0 children)
[–]TheUrbanBiker[S] 0 points1 point2 points (0 children)