Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. def drop_duplicates_in_place(lst):
  2. # Write the rest of the code for question 3b below here.
  3. i = 0
  4. while i < len(lst) - 1:
  5. if lst[i + 1: len(lst) - 1].count(lst[i]) > 0 :
  6. k = len(lst)
  7. for x in range (i + 1 , k):
  8. if lst[x] == lst[i] :
  9. del lst[x]
  10. k = k - 1
  11. i = i + 1
  12.  
  13. lst = [1,2,3,4,5,6,7,8,8,2,666,9]
  14. drop_duplicates_in_place(lst)
  15. print(lst)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement