0 out of 464 challenges solved
Write a Python function `contains_duplicates` that determines whether a given list of integers contains any duplicate elements. The function should return `True` if there are duplicates and `False` otherwise. #### Example Usage ```python [main.nopy] print(contains_duplicates([1, 2, 3, 4, 5])) # Output: False print(contains_duplicates([1, 2, 3, 4, 4])) # Output: True print(contains_duplicates([1, 1, 2, 2, 3, 3, 4, 4, 5])) # Output: True ``` #### Constraints - The input will always be a list of integers. - The list can be empty, in which case the function should return `False`.
def contains_duplicates(nums):
"""
Determine if the list contains any duplicate elements.
Args:
nums (list): A list of integers.
Returns:
bool: True if duplicates exist, False otherwise.
"""
# Placeholder for the solution
pass