Hint
๐ง Not sure where to start?
Start by asking the user to enter a list of values (words or numbers), separated by commas:
items_input = input("Enter items separated by commas: ")
Then convert that input string into a list using split(',')
, and use strip()
to remove extra spaces:
original_list = [item.strip() for item in items_input.split(',')]
Now think: how can you remove duplicates from that list? One way is by converting it to a set
. But if you want to keep the original order, a loop might be better.
Once you have the cleaned list, calculate how many items were removed:
removed_count = len(original_list) - len(cleaned_list)
Then print both the cleaned list and the number of removed items!