Skip to content

Commit d1389c0

Browse files
'Duplicates' home work
1 parent c4e3f4a commit d1389c0

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

hw_2/__init__.py

Whitespace-only changes.

hw_2/maria_iter.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def unique(lst):
2+
seen = set()
3+
return [el for el in lst if el not in seen and not seen.add(el)]
4+
5+
lst = [1, 2, 1, 3, 4, 3, 3, 3]
6+
print("Initial list: {}".format(lst))
7+
print("List with unique elements: {}".format(unique(lst)))

0 commit comments

Comments
 (0)