Answer:
Step-by-step explanation:
The following code has the two requested functions, fully working and tested for bugs. It is written in Python as is the sample code in the question and a sample output can be seen in the picture attached below.
import string
def build_wordlist(file_pointer):
words = file_pointer.read()
words = [word.strip(string.punctuation) for word in words.split()]
return words
def find_unique(word_list):
unique_words = []
for word in word_list:
if word not in unique_words:
unique_words.append(word)
return unique_words
def main():
infile = open("test.txt", 'r')
word_list = build_wordlist(infile)
new_wordlist = find_unique(word_list)
new_wordlist.sort()
print(new_wordlist)
main()