Write a program to print duplicates from a list of integer?

def duplicates(nums):
num_count = {}
for num in nums:
if num in num_count:
num_count[num] += 1
else:
num_count[num] = 1
for num, count in num_count.items():
if count > 1:
print(num)
nums = list(input("Enter your List : "))
duplicates(nums)

1 Like

well done @sriyaranipatro ,
Keep practicing and keep growing

@sriyaranipatro

Correct, keep it up.
Keep Practicing.