Skip to content

Commit

Permalink
Merge pull request #62 from MIT-Emerging-Talent/remove_duplicate
Browse files Browse the repository at this point in the history
remove duplicates
  • Loading branch information
sashour82 authored Jan 11, 2025
2 parents ab8aae7 + ef7ff1b commit be411be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions solutions/remove_duplicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ def remove_duplicates(nums: list) -> list:
['Heba', 'Noor']
"""
assert isinstance(nums, list), "The input should be a list"
result = [] # List to store the result without duplicates
result = [] # List to store the result without duplicates.

for num in nums:
if num not in result:
result.append(num) # Add the number to the result list
result.append(num) # Add the number to the result list.
return result
8 changes: 4 additions & 4 deletions solutions/tests/test_remove_duplicates.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Test module for remove_duplicates function.
Test module for remove_duplicates function
Created on 2024-12-30
Author: Heba Shaheen
Expand All @@ -17,17 +17,17 @@ class TestRemoveDuplicates(unittest.TestCase):

# Standard test cases
def test_numbers_list(self):
"""It should remove duplicates numbers"""
"""It should remove duplicates numbers. give [1, 2, 3, 4]"""
self.assertEqual(remove_duplicates([1, 2, 3, 2, 3, 4]), [1, 2, 3, 4])

def test_letters_list(self):
"""It should remove duplicates letters"""
"""It should remove duplicates letters. give ["a", "v", "e", "q"]"""
self.assertEqual(
remove_duplicates(["a", "v", "e", "e", "q"]), ["a", "v", "e", "q"]
)

def test_mix_list(self):
"""It should remove duplicates items"""
"""It should remove duplicates items. give [1, 2, 3, "e", 5, "a"]"""
self.assertEqual(
remove_duplicates([1, 2, 3, "e", 2, 1, "e", 5, "a"]), [1, 2, 3, "e", 5, "a"]
)
Expand Down

0 comments on commit be411be

Please sign in to comment.