I'm trying to write a program that allows me to get a username and password from a file. I feel like I am on the right track but, when I run the program to test whether or not it works, I get a: Name error: global name Username is not defined. Any ideas where I've gone wrong? I apologize if the formatting is off. def login(): UserName = input("Please enter your user name: ") passw = input("Please enter your password: ") check(UserName, passw) return UserName, passw def check(user, password): pword = {} for line in open('unames_passwords.txt','r'): user, password = line.split() pword[user] = password if user == UserName and password == passw: return True print("Thank you for logging in.") else: print("Username or password is incorrect") def main(): login() main() Continue reading...