Created
October 20, 2021 10:12
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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