Advertisement
H3NL3Y

Untitled

Dec 12th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.13 KB | None | 0 0
  1. def menu():
  2.   menuchoice = input('''
  3. 1. Register
  4. 2. Login
  5. 3. logout
  6. >>> ''')
  7.  
  8.   if menuchoice == '1':
  9.     register()
  10.   elif menuchoice == '2':
  11.     login()
  12.  
  13. def register():
  14.   name = input('Enter name: ')
  15.   age = input('Enter age: ')
  16.   favpizza = input('What is your fav pizza?: ')
  17.  
  18.  
  19.   letter1 = name [0:3]
  20.   username = letter1 + age
  21.   userFile = open(username , 'a')
  22.  
  23.   userFile.write(username + ',')
  24.   userFile.write(name + ',')
  25.   userFile.write(age + ',')
  26.   userFile.write(favpizza + ',')
  27.  
  28.  
  29.  
  30.   password = input('Enter password: ')
  31.   password1 = input('Enter password again: ')
  32.  
  33.   if password != password1:
  34.     print('ERROR AHHHHHH')
  35.   else:
  36.     userFile.write(password + ',')
  37.     print('password accepted! ')
  38.   userFile.close()
  39.  
  40.  
  41. def login():
  42.  
  43.   username = input ('ENTER YOUR USERNAME: ')
  44.   userFile = open(username , 'r')
  45.  
  46.   password = input('Enter password: ')
  47.  
  48.   filePull = userFile.read().split(',')
  49.  
  50.   if username in filePull and password in filePull:
  51.     print('YOUR IN! GET IN!')
  52.   else:
  53.     print(' YOU are SHAMEFUL><<><><><><><><><><>')
  54.   userFile.close()
  55.  
  56.  
  57. menu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement