Advertisement
Guest User

Untitled

a guest
Aug 31st, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.31 KB | None | 0 0
  1. from random import*
  2. with open('NEA_Summer_Username_Password_Peter_Leyden.txt', 'a')as f:
  3. f.write(' ')
  4. with open('NEA_Summer_Username_Password_Peter_Leyden.txt', 'r')as f:
  5. string33 = f.read()
  6. if string33 == ' ':
  7. username = input("Please input the username you want to use: ")
  8. password = input("PLease input the password you want to use: ")
  9. form10 = input("Please input the Form name: ")
  10. num = 1
  11. num15 = 0
  12. num30 = 1000
  13. with open('NEA_Summer_Student_File_Peter_Leyden.txt', 'w')as f:
  14. for x in range(0, 25):
  15. num50 = randint(0,1)
  16. num30 += 1
  17. num15 += 1
  18. num14 = str(num15)
  19. num31 = str(num30)
  20. f.write('Student ID: ')
  21. num4 = str(num30)
  22. f.write(num4)
  23. f.write("\nSurname: Leyden")
  24. f.write(num14)
  25. f.write("\nForename: Peter")
  26. f.write(num14)
  27. f.write('\nDate of Birth: ')
  28. f.write(num14)
  29. f.write("/07/2003\nHome Address: ")
  30. f.write(num14)
  31. f.write(" Campion Lane\nHome Phone Number: 0800 04 05 ")
  32. f.write(num14)
  33. if num50 == 0:
  34. f.write("\nGender: Male\n")
  35. else:
  36. f.write("\nGender: Female\n")
  37. f.write("Tutor Group: ")
  38. f.write(form10)
  39. f.write("\nSchool Email Address: ")
  40. f.write(num4)
  41. f.write("@school.co.uk\n\n")
  42. with open('NEA_Summer_Username_Password_Peter_Leyden.txt', 'w')as g:
  43. g.write(username)
  44. g.write('\n')
  45. g.write(password)
  46. g.write('\n')
  47. g.write(num14)
  48. g.write('\n')
  49. g.write(form10)
  50. else:
  51. with open('NEA_Summer_Username_Password_Peter_Leyden.txt', 'r')as f:
  52. username8 = f.readline()
  53. password9 = f.readline()
  54. num29 = f.readline()
  55. form10 = f.readline()
  56. num15 = int(num29)
  57. num30 = num15+1000
  58. num = 1
  59. num60 = 0
  60. num1 = 1
  61. while num60 == 0:
  62. login23 = input("Do you want to log in(l) or exit the program(x): ")
  63. if login23 == 'l':
  64. num1 = 0
  65. elif login23 == 'x':
  66. print("Goodbye")
  67. num60 = 1
  68. else:
  69. print("Come on press one of the buttons")
  70. while num1 == 0:
  71. username1 = input("Please input your username: ")
  72. string32 = ("\n")
  73. username3 = username1+string32
  74. password1 = input("Please input your password: ")
  75. password3 = password1+string32
  76. with open('NEA_Summer_Username_Password_Peter_Leyden.txt', 'r')as h:
  77. username2 = h.readline()
  78. password2 = h.readline()
  79. if username2 == username3 and password2 == password3:
  80. print("Thank you for Logging in")
  81. done = input("Press enter to continue: ")
  82. num = 0
  83. num1 = 1
  84. else:
  85. login24 = input("Either the username or password is incorrect please try again(t) or press (x) to exit the program: ")
  86. if login24 == 't':
  87. pass
  88. elif login24 == 'x':
  89. sys.exit()
  90. while num == 0:
  91. for x in range(0,50):
  92. print(" ")
  93. print("Which operations would you like to do access student information(a)")
  94. print("Reset password(r)")
  95. print("And three other reports")
  96. print("See all student information(f)")
  97. print("Add a student to the form(s)")
  98. operation = input("Or log out(l): ")
  99. if operation == 'a':
  100. print('')
  101. try:
  102. student_id = int(input("Please input the student's unique ID number: "))
  103. print("Please input a number.")
  104. if student_id <= 1000 or student_id > num30:
  105. print("That is not valid.")
  106. else:
  107. student_id1 = student_id - 1000
  108. num6 = student_id1 - 1
  109. num7 = 8
  110. num8 = num6 * 10
  111. num9 = num8 + num7
  112. num10 = num8 - 1
  113. with open('NEA_Summer_Student_File_Peter_Leyden.txt', 'r')as f:
  114. for x in range(0, num10):
  115. f.readline()
  116. for x in range(0, 10):
  117. fr = f.readline()
  118. print(fr, end='')
  119. except ValueError:
  120. print("Please input a number.")
  121. print('')
  122. done = input("Press enter to continue: ")
  123. elif operation == 's':
  124. with open('NEA_Summer_Student_File_Peter_Leyden.txt', 'a')as f:
  125. Surname = input("Please input the new student's Surname: ")
  126. Forename = input("Please input the new student's Forename: ")
  127. D_O_B = input("Please input the new student's Date Of Birth: ")
  128. Home_Address = input("Please input the new student's Home Address: ")
  129. H_P_N = input("Please input the new student's Home Phone Number: ")
  130. Gender = input("Please input the new student's Gender: ")
  131. num15 += 1
  132. num14 = str(num15)
  133. num30 += 1
  134. f.write('Student ID: ')
  135. num4 = str(num30)
  136. f.write(num4)
  137. f.write("\n")
  138. f.write("Surname: ")
  139. f.write(Surname)
  140. f.write("\nForename: ")
  141. f.write(Forename)
  142. f.write('\nDate of Birth: ')
  143. f.write(D_O_B)
  144. f.write("\nHome Address: ")
  145. f.write(Home_Address)
  146. f.write("\nHome Phone Number: ")
  147. f.write(H_P_N)
  148. f.write("\nGender: ")
  149. f.write(Gender)
  150. f.write("\nTutor Group: ")
  151. f.write(form10)
  152. f.write("\nSchool Email Address: ")
  153. f.write(num4)
  154. f.write("@school.co.uk\n\n")
  155. print("You have added a student.")
  156. with open('NEA_Summer_Username_Password_Peter_Leyden.txt', 'w')as f:
  157. f.write(username2)
  158. f.write(password2)
  159. f.write(num14)
  160. done = input("Press enter to continue: ")
  161. elif operation == 'r':
  162. passthing = input("This is where your reset your password do you want to continue(c) or stop(s): ")
  163. if passthing == 'c':
  164. username3 = input("Please input your username: ")
  165. password5 = input("Please input your current password: ")
  166. with open('NEA_Summer_Username_Password_Peter_Leyden.txt', 'r')as f:
  167. username6 = f.readline()
  168. password6 = f.readline()
  169. username7 = username3+string32
  170. password8 = password5+string32
  171. if password6 == password8 and username6 == username7:
  172. password3 = input("Please enter your new password: ")
  173. password4 = input("Please re-enter your new password: ")
  174. if password3 == password4:
  175. print("You have reset your password.")
  176. password = password3
  177. username = username7
  178. with open('NEA_Summer_Username_Password_Peter_Leyden.txt', 'w')as f:
  179. f.write(username)
  180. f.write(password)
  181. f.write("\n")
  182. else:
  183. print('You have entered 2 different passwords please try again')
  184. else:
  185. print("The username and password do not match")
  186. elif passthing == 's':
  187. print("You chose not to use the password reset function")
  188. else:
  189. print("That is not valid")
  190. done = input("Press enter to continue: ")
  191. elif operation == 'l':
  192. print("You have now logged out.")
  193. num = 1
  194. for x in range(0,50):
  195. print("\n")
  196. elif operation == 'f':
  197. with open('NEA_Summer_Student_File_Peter_Leyden.txt', 'r')as f:
  198. fr = f.read()
  199. print(fr)
  200. done = input("Press enter to continue: ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement