Advertisement
Guest User

Untitled

a guest
Mar 10th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. Func ChooseOption()
  2. print(“1. Register
  3. 2.Login
  4. 3.Quiz
  5. 4.Report”)
  6. Choice = input(“Enter choice”)
  7. if choice == 1
  8. Register()
  9. elif choice == 2
  10. Login()
  11. elif choice == 3
  12. Quiz()
  13. elif choice == 4
  14. Report()
  15.  
  16. Func Register()
  17. name = input(“Input name”)
  18. age = input(“Input age”)
  19. yrgroup = input(“Input yrgroup”)
  20. password = input(“input password use capitals”)
  21. valid = re.match("[A-Z]", password)
  22. while not valid:
  23. print(“password invalid")
  24. password = raw_input(“Re enter password")
  25. valid = re.match("[A-Z]", password)
  26. print(“valid password")
  27. username = (name[:3] and age)
  28. print( username)
  29. file = open(txt", "a")
  30. file.write(input details into txt)
  31. file.close()
  32. ChooseOption()
  33.  
  34. Func Login():
  35. username = input(username)
  36. password = input(password)
  37. for line in open(“txt","r").readlines
  38. data = line.split(",")
  39. if username == data[1] and password == data[2]:
  40. print("Correct")
  41. return True
  42. print("Incorrect")
  43. return False
  44. exit()
  45. ChooseOption()
  46. Func Quiz
  47. score = 0
  48. subject = (“Input subject)
  49. difficulty = (“Input difficulty”)
  50. file = open(subject txt, “r”)
  51. print(line1 questions)
  52. if answer = correct answer
  53. score = score + 1
  54. else
  55. Print(“Wrong”)
  56. repeat 4 more times
  57. print(User score,percentage,grade)
  58. print(“Your quiz is finshedif you would like to try
  59. again in another difficiulty please feel free to do it”)
  60. Func Report
  61. user = “admin”
  62. log = input(“Enter username”)
  63. if log == user
  64. print(“you have logged in”)
  65. else
  66. print(“Wrong details”)
  67. exit()
  68. Option = input(“Enter option a or b)
  69. if option = = a
  70. student = input(“Enter the username of the person so you can see
  71. their stats”)
  72. print(“UserStats”)
  73. else
  74. topic = input(“Enter a topic”)
  75. difficulty = input(“Enter a difficulty”)
  76. print(average score,highest score,user dets of highest score”)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement