Python Find Duplicates in List

Following is a simple Python code to find duplicates in a list:

Example

def find_duplicates(list):
    list.sort()
    for i in range(0,len(list)-1):
        if list[i] == list[i+1]:
            print(str(list[i]).rstrip())


fruits = ["banana", "apple", "grapes", "mango", "apple", "watermelon", "banana"]
find_duplicates(fruits)
Output
apple
banana