0

I have made this code in an attempt to create a simple 'Create a user' program which take the inputs and puts them into a csv file however I am finding that I keep getting the error unexpected EOF while parsing which is quite annoying. Could you please help me with this?

if sys.version_info < (3, 0):
    input = raw_input

def createAccount():
  username = enterUsername()
  password = enterPassword()
  appendAccount('All_users.csv', username, password, sname, year, age)

def enterUsername():
    while True:
        name = input('What is your first name?')
        sname = input('What is your surname?')
        year = input('what year are you in?')
        age = input('How old are you?')
        fName = name[:3]
        if len(userN) == 3:
            username = (fName+year)
            print(username)
        elif len(fName) != 3:
            username = (name[:3]+age)


def enterPassword():
    while True:
        password = input('Enter password: ')
        password_again = input('Confirm password: ')
        if len(password) < 5:
            print ('Your password is too short.')
        elif password != password_again:
            print ('Password and confirmation do not match.')
        else:
            return password

def appendAccount(All_users, username, password, sname, year, age):
  with open(All_users, 'a') as csv_file:                                                                        
Eugene Lisitsky
  • 12,113
  • 5
  • 38
  • 59
J.Arthur
  • 1
  • 1

1 Answers1

0

Is end of the file?

def appendAccount(All_users, username, password, sname, year, age):
  with open(All_users, 'a') as csv_file:         
    ....  # here should be continuation
Eugene Lisitsky
  • 12,113
  • 5
  • 38
  • 59