I'm trying to get the variable Intadd
to change from the number 0, but I can't because Intadd
is in the function, causing it to remain 0 no matter what. I tried moving the variable Intadd
outside of the function, but then it says that Intadd
is already refferenced before assignment (the only time Intadd
is run in my whole code is in this function).
dictfile = open('c:/ScienceFairDictionaryFolder/wordsEn.txt', 'r')
DictionaryWords = dictfile.readlines()
def Number_Finder():
for x in DictionaryWords:
Intadd = 0
print(Intadd)
if x.replace("\n", str(Intadd)) == Password:
print("Congrats, you found the password!")
break
else:
while Intadd < 10:
Intadd += 1
Thanks for the help, you guys are lifesavers!