Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_question() :
- questionBank = [
- ["What color is the daytime sky on a clear day?", "blue"],
- ["What is the answer to life, the universe and everything?", "42"],
- ["What is a three letter word for mouse trap?", "cat"],
- ["What is always in front of you but canβt be seen?", "future"]
- ["What is full of holes but still holds water?", "sponge"],
- ["What gets wet while drying?", "towel"]
- ]
- return questionBank
- def check_question(row) :
- q = row[0]
- a = row[1]
- user_a = input(q)
- if user_a == a :
- print("Correct!")
- return True
- else :
- print(f"Incorrect! The correct answer was {a}")
- return False
- def main(questionBank) :
- if len(questionBank) == 0 :
- print("No question were given")
- return 0
- index = 0
- right = 0
- while index < len(questionBank) :
- # print(questionBank[index])
- result = check_question(questionBank[index])
- if result :
- right +=1
- index +=1
- print(f"your score is {right/len(questionBank)*100}")
- main(get_question())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement