Advertisement
Guest User

Untitled

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