Advertisement
Guest User

Untitled

a guest
Aug 30th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.83 KB | None | 0 0
  1. from random import*
  2. with open('nea_summer_username_password.txt', 'a')as f:
  3. f.write(' ')
  4. with open('nea_summer_username_password.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. num = 1
  10. num15 = 0
  11. num40 = 25
  12. num30 = 1000
  13. with open('nea_summer.txt', 'w')as f:
  14. for x in range(0, num40):
  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: Maple\n")
  38. f.write("School Email Address: ")
  39. f.write(num4)
  40. f.write("@school.co.uk\n\n")
  41. with open('nea_summer_username_password.txt', 'w')as g:
  42. g.write(username)
  43. g.write('\n')
  44. g.write(password)
  45. g.write('\n')
  46. else:
  47. pass
  48. while True:
  49. num1 = 0
  50. while num1 == 0:
  51. username1 = input("Please input your username: ")
  52. string32 = ("\n")
  53. username3 = username1+string32
  54. password1 = input("Please input your password: ")
  55. password3 = password1+string32
  56. with open('nea_summer_username_password.txt', 'r')as h:
  57. username2 = h.readline()
  58. password2 = h.readline()
  59. if username2 == username3 and password2 == password3:
  60. print("Thank you for Logging in")
  61. done = input("Press enter to continue: ")
  62. num = 0
  63. num1 = 1
  64. else:
  65. print("Either the username or password is incorrect please try again")
  66. while num == 0:
  67. for x in range(0,50):
  68. print(" ")
  69. print("Which operations would you like to do access student information(a)")
  70. print("Reset password(r)")
  71. print("And three other reports")
  72. print("See all student information(f)")
  73. print("Add a student to the form(s)")
  74. operation = input("Or log out(l): ")
  75. if operation == 'a':
  76. print('')
  77. student_id = int(input("Please input the student's unique ID number: "))
  78. if student_id <= 1000 or student_id > num30:
  79. print("That is not valid.")
  80. else:
  81. student_id1 = student_id - 1000
  82. num6 = student_id1 - 1
  83. num7 = 8
  84. num8 = num6 * 10
  85. num9 = num8 + num7
  86. num10 = num8 - 1
  87. with open('nea_summer.txt', 'r')as f:
  88. for x in range(0, num10):
  89. f.readline()
  90. for x in range(0, 10):
  91. fr = f.readline()
  92. print(fr, end='')
  93. done = input("Press enter to continue: ")
  94. elif operation == 's':
  95. with open('nea_summer.txt', 'a')as f:
  96. Surname = input("Please input the new student's Surname: ")
  97. Forename = input("Please input the new student's Forename: ")
  98. D_O_B = input("Please input the new student's Date Of Birth: ")
  99. Home_Address = input("Please input the new student's Home Address: ")
  100. H_P_N = input("Please input the new student's Home Phone Number: ")
  101. Gender = input("Please input the new student's Gender: ")
  102. num15 += 1
  103. num14 = str(num15)
  104. num30 += 1
  105. f.write('Student ID: ')
  106. num4 = str(num30)
  107. f.write(num4)
  108. f.write("\n")
  109. f.write("Surname: ")
  110. f.write(Surname)
  111. f.write("\nForename: ")
  112. f.write(Forename)
  113. f.write('\nDate of Birth: ')
  114. f.write(D_O_B)
  115. f.write("\nHome Address: ")
  116. f.write(Home_Address)
  117. f.write("\nHome Phone Number: ")
  118. f.write(H_P_N)
  119. f.write("\nGender: ")
  120. f.write(Gender)
  121. f.write("\nTutor Group: Maple\n")
  122. f.write("School Email Address: ")
  123. f.write(num4)
  124. f.write("@school.co.uk\n\n")
  125. print("You have added a student.")
  126. done = input("Press enter to continue: ")
  127. elif operation == 'r':
  128. passthing = input("This is where your reset your password do you want to continue(c) or stop(s): ")
  129. if passthing == 'c':
  130. username3 = input("Please input your username: ")
  131. password5 = input("Please input your current password: ")
  132. with open('nea_summer_username_password.txt', 'r')as f:
  133. username6 = f.readline()
  134. password6 = f.readline()
  135. username7 = username3+string32
  136. password8 = password5+string32
  137. if password6 == password8 and username6 == username7:
  138. password3 = input("Please enter your new password: ")
  139. password4 = input("Please re-enter your new password: ")
  140. if password3 == password4:
  141. print("You have reset your password.")
  142. password = password3
  143. username = username7
  144. with open('nea_summer_username_password.txt', 'w')as f:
  145. f.write(username)
  146. f.write(password)
  147. f.write("\n")
  148. else:
  149. print('You have entered 2 different passwords please try again')
  150. else:
  151. print("The username and password do not match")
  152. elif passthing == 's':
  153. print("You chose not to use the password reset function")
  154. else:
  155. print("That is not valid")
  156. done = input("Press enter to continue: ")
  157. elif operation == 'l':
  158. print("You have now logged out.")
  159. num = 1
  160. elif operation == 'f':
  161. with open('nea_summer.txt', 'r')as f:
  162. fr = f.read()
  163. print(fr)
  164. done = input("Press enter to continue: ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement