Im new to programming python3 and i'm trying to write a password program. i want to compare a word from a .txt file with a input. no matter if i type the password in write or wrong it always comes up 'access denied!'

inFile = open('passwordtest.txt', 'r')
password = inFile.read()
userguess = input("Enter password: ")
if password == userguess:
    print('Access Granted!')
else:
    print('Access Denied!')
    input()

Thank you in advanced!!

After line 3, add

print(repr(password))
print(repr(userguess))

then you can compare visually the two strings.

thank you i tried it this just and it worked. what does repr() mean?

I could not explain this better than the python documentation. An advantage of printing the repr of a string is that you can see the non printable characters contained in the string. For example a newline character is represented as \n.