Skip to content

Instantly share code, notes, and snippets.

View joguiguma's full-sized avatar

Jose Guillermo Guarnizo joguiguma

View GitHub Profile
@joguiguma
joguiguma / gist:7e6f386b6643ace1f323974e603c54b6
Created August 18, 2020 04:04
Open the file romeo.txt and read it line by line. For each line, split the line into a list of words using the split() method. The program should build a list of words. For each word on each line check to see if the word is already in the list and if not append it to the list. When the program completes, sort and print the resulting words in alp…
fname = input("Enter file name: ")
fh = open(fname)
lst = list()
for line in fh:
line = line.rstrip()
line = line.split()
for c in line:
if c in lst:
continue
else: