Advertisement
Guest User

Untitled

a guest
Mar 9th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. file = open("logindata.txt", "r")
  2. data_list = file.readlines()
  3. file.close()
  4. print(data_list)
  5.  
  6.  
  7. for i in range(0, len(data_list)):
  8. username = input("username: ")
  9. password = input("password: ")
  10. i += 1
  11. if i % 2 == 0:
  12. if data_list[i] == username and data_list[i + 1] == password:
  13. print("You are successfully logged in as", username)
  14. i == len(data_list)
  15. elif data_list[i] == username and data_list[i + 1] != password:
  16. print("The password you entered was incorrect, please try again.")
  17. else: # how do i end the code if the user inputs no
  18. if data_list[i] != username:
  19. choice = input("The username you entered was not found, would you like to create an account? (Y/N)")
  20. if choice.upper() == "Y":
  21. new_username = input("new username: ")
  22. data_list.append(new_username + "n")
  23. new_password = input("new password: ")
  24. data_list.append(new_password + "n")
  25. file = open("logindata.txt", "w")
  26. file.writelines(data_list)
  27. i == data_list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement