- Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathq10.py
15 lines (9 loc) · 645 Bytes
/
q10.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Question:
# Write a program that accepts a sequence of whitespace separated words as input and prints the words after removing all duplicate words and sorting them alphanumerically.
# Suppose the following input is supplied to the program:
# hello world and practice makes perfect and hello world again
# Then, the output should be:
# again and hello makes perfect practice world
word=sorted(list(set(input().split()))) # input string splits -> converting into set() to store unique
# element -> converting into list to be able to apply sort
print(" ".join(word))