Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def ask_question(question, answer):
- if input(question + "? ") == answer:
- print("Risposta esatta")
- return 1
- else:
- print("Risposta errata")
- return 0
- unpickled_list = [("domanda1", "risposta1"), ("domanda2", "risposta2"), ("domanda3", "risposta3")]
- res = [ask_question(question, answer) for question, answer in unpickled_list]
- print("Risposte corrette di Pari: {}".format(sum([res[i] for i in range(len(res)) if i % 2 == 0])))
- print("Risposte corrette di Dispari: {}".format(sum([res[i] for i in range(len(res)) if i % 2 == 0])))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement