SHARE
TWEET

Untitled

a guest Apr 27th, 2018 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import time
  2. def register():
  3.     username = input("Please enter a username: ")
  4.     print('')
  5.     password = input("Please enter your desired password: ")
  6.     print('')
  7.     file = open("accountfile3.txt","a")
  8.     file.write(username)
  9.     file.write(" ")
  10.     file.write(password)
  11.     file.write("n")
  12.     file.close()
  13.     if login():
  14.         print("You are now logged in...")
  15.     else:
  16.         print("You aren't logged in!")
  17. def login():
  18.     x = False
  19.     while x == False:
  20.         username = input("Please enter your username: ")
  21.         print('')
  22.         password = input("Please enter your password: ")
  23.         print('')
  24.         for line in open("accountfile3.txt","r").readlines(): # Read the lines
  25.             login_info = line.split() # Split on the space, and store the results in a list of two strings
  26.         if username == login_info[0] and password == login_info[1]:
  27.             print("Correct credentials!")
  28.             return True
  29.  
  30.         break
  31.     print("Incorrect credentials.")
  32.     print('')
  33. print('Hello')
  34. print('')
  35. time.sleep(1)
  36. print('This is python_workspace')
  37. print('')
  38. time.sleep(1)
  39. print('These are the choices available: ')
  40. print('')
  41. print('|' + '-'*24 + '|')
  42. print('|    1. Register         |')
  43. print('|                        |')
  44. print('|    2. Login            |')
  45. print('|                        |')
  46. print('|    3. Exit             |')
  47. print('|' + '-'*24 + '|')
  48. y = True
  49. while y == True:
  50.     choice1 = input('Please enter the number: ')
  51.     print('')
  52.     if choice1 == '1':
  53.         register()
  54.         break
  55.     elif choice1 == '2':
  56.         login()
  57.         break
  58.     elif choice1 == '3':
  59.         break
  60.     else:
  61.         print('Incorrect input, please enter either: 1, 2, 3')
  62.         print('')
  63.    
  64. import time
  65. def register():
  66.     username = input("Please enter a username: ")
  67.     print('')
  68.     password = input("Please enter your desired password: ")
  69.     print('')
  70.     file = open("accountfile3.txt","a")
  71.     file.write(username)
  72.     file.write(" ")
  73.     file.write(password)
  74.     file.write("n")
  75.     file.close()
  76.     if login():
  77.         print("You are now logged in...")
  78.     else:
  79.         print("You aren't logged in!")
  80. def login():
  81.     x = False
  82.     while x == False:
  83.         username = input("Please enter your username: ")
  84.         print('')
  85.         password = input("Please enter your password: ")
  86.         print('')
  87.         for line in open("accountfile3.txt","r").readlines(): # Read the lines
  88.             login_info = line.split() # Split on the space, and store the results in a list of two strings
  89.             if username == login_info[0] and password == login_info[1]:
  90.                 print("Correct credentials!")
  91.                 return True
  92.  
  93.         break
  94.     print("Incorrect credentials.")
  95.     print('')
  96. print('Hello')
  97. print('')
  98. time.sleep(1)
  99. print('This is python_workspace')
  100. print('')
  101. time.sleep(1)
  102. print('These are the choices available: ')
  103. print('')
  104. print('|' + '-'*24 + '|')
  105. print('|    1. Register         |')
  106. print('|                        |')
  107. print('|    2. Login            |')
  108. print('|                        |')
  109. print('|    3. Exit             |')
  110. print('|' + '-'*24 + '|')
  111. y = True
  112. while y == True:
  113.     choice1 = input('Please enter the number: ')
  114.     print('')
  115.     if choice1 == '1':
  116.         register()
  117.         break
  118.     elif choice1 == '2':
  119.         login()
  120.         break
  121.     elif choice1 == '3':
  122.         break
  123.     else:
  124.         print('Incorrect input, please enter either: 1, 2, 3')
  125.         print('')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top