trys = 5 acc = input("Would you like to create an account? (Y/N): ") if acc == "Y": print("Enter a username and password") username = input("Username: ") password = input("Password: ") print("Sign in:") while trys > 0: user = input("Username: ") key = input("Password: ") if user == username and key == password: print("Welcome") else: print("Password incorrect!") loop = input("Would you like to try again? (Y/N): ") if loop == "Y" and trys > 0: trys = trys - 1 print(trys, "trys left") elif acc == "N": print("Thank you for visiting.") else: print("Invalid input.")