H3NL3Y

Untitled

Nov 23rd, 2017
40
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.write(username + ',')
  22.  
  23.  
  24.   userFile = open(username , 'a')
  25.   userFile.write(name + ',')
  26.   userFile.write(age + ',')
  27.   userFile.write(favpizza + ',')
  28.  
  29.  
  30.  
  31.   password = input('Enter password: ')
  32.   password1 = input('Enter password again: ')
  33.  
  34.   if password != password1:
  35.     print('ERROR AHHHHHH')
  36.   else:
  37.     userFile.write(password + ',')
  38.     print('password accepted! ')
  39.  
  40.  
  41. def login():
  42.  
  43.   userFile = open('userdetails.txt' , 'r')
  44.   username = input('Enter username: ')
  45.   password = input('Enter password: ')
  46.  
  47.   filePull = userFile.read().split(',')
  48.  
  49.   if username in filePull and password in filePull:
  50.     print('YOUR IN! GET IN!')
  51.   else:
  52.     print(' YOU are SHAMEFUL><<><><><><><><><><>')
  53.  
  54.  
  55. menu()
Add Comment
Please, Sign In to add comment