name1=input("Give 1st name: ")
name2=input("Give 2nd name: ")
name3=input("Give 3rd name: ")
names = [name1, name2, name3]
names = list(set(names))
names.sort()
print("names in alphabetical order: {}, {} and {}".format(*nimet))
My code gives error: tuple index out of range when 2 names are same. When inputs are like Ava, Benjamin and Charlie, I want the output to be like: names in alphabetical order: Ava, Benjamin and Charlie but when inputs are like Ava, Benjamin, Ava, I want the output to be like: names in alphabetical order: Ava and Benjamin