Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save naemazam/61f956310861ab35f4e156731efa4a08 to your computer and use it in GitHub Desktop.
Save naemazam/61f956310861ab35f4e156731efa4a08 to your computer and use it in GitHub Desktop.
Enter a series of English names separated by commas, including duplicate names. Please remove the duplicate names and output a list containing non duplicate names. The order of names is the same as that of input
def unique_list(text_str):
l = text_str.split()
temp = []
for x in l:
if x not in temp:
temp.append(x)
return ' '.join(temp)
text_str = input("enter names: ")
print("Original String:")
print(text_str)
print("\nAfter removing duplicate names from lists: :")
print(unique_list(text_str))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment