My program contains quite a lot so I'm not going to bore you with the details, if there are any other problems that you spot which I haven't, you don't need to point them out unless you have a serious case of OCD. Here is the parts of the program relevant to the question I'm asking.
def LettersIntoCode():
cluesFile = open("clues.txt", 'r+')
cluesLines = cluesFile.readlines()
cluesFile.close()
clues = {}
for line in cluesLines:
clues[line[1]] = line[0]
CodedFile = open('words.txt')
print()
for line in CodedFile:
***WordsWithChanges = (''.join(clues.get(c,c) for c in line.strip('\r\n')))***
print(WordsWithChanges)
CodedFile.close()
def GameCompletion():
SolvedFile = open("solved.txt", 'r')
***while WordsWithChanges != SolvedFile***:
MenuChoice()
SolvedFile.close()
When called upon this error pops up:
while WordsWithChanges != SolvedFile:
NameError: global name 'WordsWithChanges' is not defined
Now don't worry about anything else but the Bold and Italic although you may find the other stuff useful for understanding purposes. I've tried putting inglobal WordsWithChanges
but as most will know that didn't work, thanks for your co-operation, if you need anything just ask!