Guest User

Untitled

a guest
Oct 15th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.50 KB | None | 0 0
  1. import time
  2. import sys
  3. from time import sleep
  4. def reading(username): #defining reading for reading the files inputed by the user.
  5. print(">>>READING FILES<<<") #Just creating an enviroment that the system is reading the files
  6. time.sleep(2)
  7. print("Please Wait for a moment while reading files..")
  8. time.sleep(5)
  9. print("Files are ready")
  10. print("........ ")
  11. time.sleep(1)
  12. print("........ ")
  13. time.sleep(2)
  14. print("type the code of the course you want to read")
  15. time.sleep(.7)
  16. print("What Course you Want to read? [01.BET-COET |02. BSIE-IA |03. BSIE-ICT]| 04. exit") #Printing the options / codes to be used by the user
  17. while True:
  18. options = input(username + ":") #Asking for what options the user want either 01,02,03.
  19. if options == "01":
  20. print("Reading")
  21. time.sleep(2)
  22. print("BET-COET")
  23. coet()
  24. elif options == "02":
  25. print('Reading')
  26. time.sleep(2)
  27. print("BSIE-IA")
  28. ia()
  29. elif options == "03":
  30. print("Reading")
  31. time.sleep(2)
  32. print("BSIE-ICT")
  33. ict()
  34. elif options == "04":
  35. print("EXITING.")
  36. time.sleep(3)
  37. session(username)
  38. else:
  39. print("error, you didn't input the correct code.") #Error if the user didn't follow the code
  40. time.sleep(1.2)
  41. def delete(username):
  42. while True:
  43. print("n"," Which Course you want to clear? |i. BET-COET| ii. BSIE-IA| iii. BSIE-ICT|(type exit if you want to exit)|") # Deleting student's name
  44. print("Input The Correct Code of the Course You Want to Clear")
  45. options = input(username + ":")
  46. if options == "i".lower():
  47. print("Deleting")
  48. time.sleep(2)
  49. file = open("coet.txt", "w")
  50. file.write(" ")
  51. file.close()
  52. time.sleep(.5)
  53. print("DELETED")
  54. time.sleep(.5)
  55. elif options == "ii".lower():
  56. print("Deleting")
  57. time.sleep(2)
  58. file = open("IA", "w")
  59. file.write(" ")
  60. file.close()
  61. time.sleep(.5)
  62. print("DELETED")
  63. time.sleep(.5)
  64. elif options == "iii".lower():
  65. print("Deleting")
  66. time.sleep(2)
  67. file = open("ICT", "w")
  68. file.write(" ")
  69. file.close()
  70. time.sleep(.5)
  71. print("DELETED")
  72. time.sleep(.5)
  73. elif options == "exit".lower():
  74. time.sleep(2)
  75. print("Exiting")
  76. time.sleep(1)
  77. session(username)
  78. return True
  79. else:
  80. print("ERROR YOU DIDN'T INPUT THE CORRECT CODE")
  81. time.sleep(1.2)
  82. def coet(): #defining BET-CoET as a module to call to read the file inputed.
  83. try:
  84. file = open("coet.txt", 'r')
  85. data = file.readlines()
  86. file.close()
  87. for line in data:
  88. print(line)
  89. except:
  90. print("Error. You didn't input any students in BET-CoET")
  91. def ia(): ##defining BSIE-IA as a module to call to read the file inputed.
  92. try:
  93. file = open("IA", 'r')
  94. data = file.readlines()
  95. file.close()
  96. for line in data:
  97. print(line)
  98. except:
  99. print("Error. You didn't input any students in BSIE-IA")
  100. def ict(): ##defining BSIE-ICT as a module to call to read the file inputed.
  101. try:
  102. file = open("ICT", 'r')
  103. data = file.readlines()
  104. file.close()
  105. for line in data:
  106. print(line)
  107. except:
  108. print("Error. You didn't input any students in BSIE-ICT")
  109. def register(): #Registering as a new user
  110. print("WELCOME")
  111. print("Please Register your Account")
  112. time.sleep(1)
  113. print("No SPACING in the account register available is only (_*Under-score,-*Hyphen)")
  114. time.sleep(1)
  115. username = input("Please Input Your Desired username: ")
  116. password = input("Please input your desired password: ")
  117. file = open("accountfile.txt","a")
  118. file.write(username)
  119. file.write(" ")
  120. file.write(password)
  121. file.write("n")
  122. file.close()
  123. if login():
  124. print("You are now logged in...")
  125. def login(): #Logging in by using the saved credentials
  126. tries = 3 #creating a limiter, in case that the user is trolling in logging on his/her account
  127. while tries != 0:
  128. tries -= 1 # Decrementation
  129. time.sleep(1)
  130. print(" Welcome User! Please Login to your Account")
  131. username = input("Please enter your username:")
  132. password = input("Please enter your password:")
  133. for line in open("accountfile.txt", "r").readlines(): # Read the lines
  134. login_info = line.split() # Split on the space, and store the results in a list of two strings
  135. if username == login_info[0] and password == login_info[1]:
  136. print("Correct credentials!")
  137. session(username)
  138. return True
  139. print("Access Denied", + tries, "Tries Left")
  140. if tries == 0:
  141. print("You Have Entered incorrect credentials 3 times", "n", "exiting")
  142. time.sleep(2)
  143. start()
  144. return False
  145. def session(username):
  146. global students
  147. global ns
  148. print("Welcome to your account " + username)
  149. print("Type The code of options you want to pick")
  150. time.sleep(.8)
  151. print(" Options:|1.course read|2. course input new students| 3. Delete all information |4. logout"), "n"
  152. while True:
  153. option = input(username + ":")
  154. if option == "4":
  155. print("Logging out...")
  156. time.sleep(1.5)
  157. print('Logout Complete')
  158. time.sleep(1)
  159. start()
  160. if option == "2":
  161. print("What Course you Want to add? [a.BET-COET |b. BSIE-IA |c. BSIE-ICT]") #asking what course the user want to add
  162. option = input(username + ":")
  163. while True:
  164. if option == "a".lower():
  165. print("BET-COET PICKED!", "n", "Reminder! | Type 'exit' if you want to exit")
  166. while True:
  167. students = input("Please Input your Student's Name: ")
  168. if students == "exit".lower():
  169. print("Exiting..")
  170. session(username)
  171. ns = input("Non Stem | Stem: ")
  172. if ns == "exit".lower():
  173. print("Exiting..")
  174. session(username)
  175. else:
  176. dict = {}
  177. file = open("coet.txt", "a+")
  178. dict["Student's Name"] = students
  179. dict["Non Stem | Stem"] = ns
  180. file.write(str(dict) + "n")
  181. file.close()
  182. elif option == "b".lower():
  183. print("BSIE-IA PICKED!", "n", "Reminder! | Type 'exit' if you want to exit")
  184. while True:
  185. students = input("Please Input your Student's Name: ")
  186. if students == "exit":
  187. print("Exiting..")
  188. session(username)
  189. ns = input("Non Stem | Stem: ")
  190. if ns == "exit":
  191. print("Exiting..")
  192. session(username)
  193. else:
  194. dict = {}
  195. file = open("IA", "a+")
  196. dict["Student's Name"] = students
  197. dict["Non Stem | Stem"] = ns
  198. file.write(str(dict) + 'n')
  199. file.close()
  200. elif option == "c".lower():
  201. print("BSIE-ICT PICKED!", "n", "Reminder! | Type 'exit' if you want to exit")
  202. while True:
  203. students = input("Please Input your Student's Name: ")
  204. if students == "exit":
  205. print("Exiting..")
  206. session(username)
  207. ns = input("Non Stem | Stem: ")
  208. if ns == "exit":
  209. print("Exiting..")
  210. session(username)
  211. else:
  212. dict = {}
  213. file = open("ICT", "a+")
  214. dict["Student's Name"] = students
  215. dict["Non Stem | Stem"] = ns
  216. file.write(str(dict) + 'n')
  217. file.close()
  218. elif option == "1":
  219. reading(username)
  220. elif option == "3":
  221. delete(username)
  222.  
  223.  
  224. def main():
  225. hp = ("****WELCOME****") #The VERY START OF THE PROGRAM
  226. for char in hp: #Adding some cool things in the program to make it creative
  227. sleep(.1)
  228. sys.stdout.write(char)
  229. sys.stdout.flush()
  230. print("n", "Student's Checklist V1.0 :IHG VERSION") #credits to the one who help me! "IVAN HAYZ GONZALES"
  231. time.sleep(1.2)
  232. start() #Calling the Module Found
  233. def start():
  234. stop = 3 # Limit the user on how he can troll
  235. while stop != 0:
  236. stop -= 1
  237. userchoice = input("New User? Y/N?").lower()
  238. if userchoice == "y":
  239. register()
  240. elif userchoice == "n":
  241. login()
  242. break
  243. else:
  244. print("ERROR. Please enter again", + stop, "Tries Left")
  245. main()
Add Comment
Please, Sign In to add comment