Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Func ChooseOption()
- print(“1. Register
- 2.Login
- 3.Quiz
- 4.Report”)
- Choice = input(“Enter choice”)
- if choice == 1
- Register()
- elif choice == 2
- Login()
- elif choice == 3
- Quiz()
- elif choice == 4
- Report()
- Func Register()
- name = input(“Input name”)
- age = input(“Input age”)
- yrgroup = input(“Input yrgroup”)
- password = input(“input password use capitals”)
- valid = re.match("[A-Z]", password)
- while not valid:
- print(“password invalid")
- password = raw_input(“Re enter password")
- valid = re.match("[A-Z]", password)
- print(“valid password")
- username = (name[:3] and age)
- print( username)
- file = open(txt", "a")
- file.write(input details into txt)
- file.close()
- ChooseOption()
- Func Login():
- username = input(username)
- password = input(password)
- for line in open(“txt","r").readlines
- data = line.split(",")
- if username == data[1] and password == data[2]:
- print("Correct")
- return True
- print("Incorrect")
- return False
- exit()
- ChooseOption()
- Func Quiz
- score = 0
- subject = (“Input subject)
- difficulty = (“Input difficulty”)
- file = open(subject txt, “r”)
- print(line1 questions)
- if answer = correct answer
- score = score + 1
- else
- Print(“Wrong”)
- repeat 4 more times
- print(User score,percentage,grade)
- print(“Your quiz is finshedif you would like to try
- again in another difficiulty please feel free to do it”)
- Func Report
- user = “admin”
- log = input(“Enter username”)
- if log == user
- print(“you have logged in”)
- else
- print(“Wrong details”)
- exit()
- Option = input(“Enter option a or b)
- if option = = a
- student = input(“Enter the username of the person so you can see
- their stats”)
- print(“UserStats”)
- else
- topic = input(“Enter a topic”)
- difficulty = input(“Enter a difficulty”)
- print(average score,highest score,user dets of highest score”)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement