fname = input("Enter file name: ")
if len(fname) < 1 : fname = "romeo.txt"
fh = open(fname)
lst = []
loop over the text
for lin in fh: # split the lines lin = lin.rstrip() lin = lin.split() # loop over the split lines for a in lin: # write a condit to determine if a word is unique # append the word to the empty list lst.append(a)
lst.sort() print(lst)
https://www.py4e.com/code3/romeo.txt?PHPSESSID=4eb3426c73615745fa14760acf0d7a88