Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- file = open("logindata.txt", "r")
- data_list = file.readlines()
- file.close()
- print(data_list)
- for i in range(0, len(data_list)):
- username = input("username: ")
- password = input("password: ")
- i += 1
- if i % 2 == 0:
- if data_list[i] == username and data_list[i + 1] == password:
- print("You are successfully logged in as", username)
- i == len(data_list)
- elif data_list[i] == username and data_list[i + 1] != password:
- print("The password you entered was incorrect, please try again.")
- else: # how do i end the code if the user inputs no
- if data_list[i] != username:
- choice = input("The username you entered was not found, would you like to create an account? (Y/N)")
- if choice.upper() == "Y":
- new_username = input("new username: ")
- data_list.append(new_username + "n")
- new_password = input("new password: ")
- data_list.append(new_password + "n")
- file = open("logindata.txt", "w")
- file.writelines(data_list)
- i == data_list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement