Hi guys I need some hints how to make this function. The instructions say to make a function that detects duplicates in a given list with the parameter named "elements". It also says to use set(). Here's what I've written. Output gives nothing.
#// BEGIN_TODO [Duplicate_detection] Duplicate detection
def has_duplicates(elements) -> bool:
'''
This function tells us whether there's dupplicated items in the list or not.
>>> emilys_list = ["tree", "cat", "dog"]
return False
>>> emilys_list = [1,2,3,1]
return True
'''
emilys_list = list[any]
set1 = set(emilys_list)
for i in range(emilys_list):
if i == i+1:
print(set1)
return True
else:
return False
print(set1)
set1 = set(emilys_list)
return set1
#// END_TODO [Duplicate_detection]
Thanks in advance!