Skip to content

Commit

Permalink
Revert "Delete solutions/Remove_Duplicates.py"
Browse files Browse the repository at this point in the history
This reverts commit 3fd6e39.
  • Loading branch information
Emanfalouji committed Jan 13, 2025
1 parent 5c3c6c0 commit 25ed4d0
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions solutions/Remove_Duplicates.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""
A module for removing duplicates from a list of numbers
Module contents:
- Remove_Duplicates: Remove any duplicate numbers in the list
Created on 2025-1-4
@author: Safaa Osman
"""


def Remove_Duplicates(items: list) -> list:
"""
This Function Removes any duplicates elements from the list
Arguments: list of elements
Returns: list of elements without duplicates.
Raises:
AssertionError: if the input is not a list
Examples:
>>> Remove_Duplicates(['a','b','a'])
['a', 'b']
>>> Remove_Duplicates([1,1,2])
[1, 2]
>>> Remove_Duplicates([1,2,2,3,3,3])
[1, 2, 3]
>>> Remove_Duplicates([1])
[1]
>>> Remove_Duplicates([])
[]
>>> Remove_Duplicates([5,5,5,5,5,5,5])
[5]
"""
assert isinstance(items, list), "input must be a list"

Final_list = []
for item in items:
if item not in Final_list:
Final_list.append(item)
return Final_list

0 comments on commit 25ed4d0

Please sign in to comment.