mardi 28 mai 2019

My code will not work and i dont understand why

Homework assignment for a log in system with a create account extension.

I have tried lots of different things but to no avail.

valid = True
while valid:
  try:
    x = input("Do you want to Login (A) or Create account (y)?")
      if x == y:
        file = open("database.txt", "r")
        username = input("Enter a username :")
        password = input("Now enter a password :")
        print("Your username is", username,".")
        file = open("database.txt","a")
        file.write (username)
        file.write (",")
        file.write (password)
        file.write("\n")
        file.close()
      else:
        username = input("Enter your username")

i expect it to carry out the function but have no idea why it is not.

Aucun commentaire:

Enregistrer un commentaire