I need to convert unique.py to include a main function along with three other functions. Other functions would be buildUnique(), sortUnique() and print(unique(). unique.py listed below
"""
File: unique.py
Project 5.7
Prints the unique words in a text file in alphabetical order.
"""
# Take the input file name
inName = input("Enter the input file name: ")
# Open the input file and initialize list of unique words
inputFile = open(inName, 'r')
uniqueWords = []
# Add the unique words in the file to the list
for line in inputFile:
words = line.split()
for word in words:
if not word in uniqueWords:
uniqueWords.append(word)
uniqueWords.sort()
# Prints the unique words
for word in uniqueWords:
print(word)
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment