Apr-10-2020, 09:59 PM
Thanks to all those who viewed my code. I have managed to fix the error and outputted the excepted results. This is how the code should be to output the words in the list in alphabetical order.
name = input('Enter file: ') handle = open(name, 'r') wordlist = list() for line in handle: words = line.split() for word in words: if word in wordlist: continue wordlist.append(word) wordlist.sort() print(wordlist)