Message370245
a = [0, 1, 2, 3, 4, 1, 2, 3, 5]
for i in a:
if a.count(i) > 1:
a.remove(i)
print(a)
"""
Output
[0, 4, 1, 2, 3, 5]
"""
It's working fine for the above code.
Yes I can use set for this but I tried with count and remove. |
|
Date |
User |
Action |
Args |
2020-05-28 16:44:29 | cmaliwal | set | recipients:
+ cmaliwal, remi.lapeyre |
2020-05-28 16:44:29 | cmaliwal | set | messageid: <1590684269.11.0.445023481204.issue40809@roundup.psfhosted.org> |
2020-05-28 16:44:29 | cmaliwal | link | issue40809 messages |
2020-05-28 16:44:29 | cmaliwal | create | |
|