Question: I write function called has_duplicates that takes a list and returns True if there is any element that appears more than once. It should not
I write function called has_duplicates that takes a list and returns True if there is any element that appears more than once. It should not modify the original list.
For example:
>>> t1 = [5, 1, 2, 3, 4]
>>> has_duplicates(t1)
False
>>> t2 = [5, 1, 2, 3, 2, 8, 10]
>>> has_duplicates(t2)
True
Step by Step Solution
There are 3 Steps involved in it
You can create a hasduplicates function in Python that checks if there are any duplicate ele... View full answer
Get step-by-step solutions from verified subject matter experts
