Created
October 15, 2018 17:54
-
-
Save XChrisUnknownX/0a3669dd955120a52819f0b720dd960b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#If the program works correctly you should be able to give it a txt with a word on each line and it should give you a new txt with the words sorted alphabetically. | |
#It should also theoretically give a list of all the words at the end. | |
#Use chammy.txt to test. | |
filename = input("Specify txt you wish to sort: ") | |
with open(filename,"r") as sortfile, open("Sorted File.txt","x") as newfile: | |
newlist = [] | |
for line in sortfile: | |
item = sortfile.readline() | |
newlist.append(item) | |
newlist.sort() | |
counter = 0 | |
while counter < len(newlist): | |
newfile.write(newlist[counter]) | |
counter += 1 | |
newfile.write(newlist+"\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
walrus | |
makeup | |
realize | |
artichoke | |
amnesty | |
gamer | |
play | |
pork | |
hand | |
land | |
fanned | |
cramped | |
joker | |
box | |
go | |
try | |
mark | |
fall | |
lose | |
loser | |
start | |
restart | |
preliminary |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment