Write a program to remove the duplicate words


Topic: Write a program to remove the duplicate words

Solution

s = "Hello world Hello"
l = s.split() 
k = [] 
for i in l: 
    if (s.count(i)>1 and (i not in k)or s.count(i)==1): 
        k.append(i) 
print(' '.join(k)) 



List all Python Programs