fork download
  1. questions_and_answers = (('2+2 = ?', '4'),
  2. ('How many books in HP series?', '7'),
  3. ('Who is your mother?', 'Whore'))
  4.  
  5. correct_answers = 0
  6. for question, answer in questions_and_answers:
  7. # print(question)
  8. if input(question + '\n') == answer:
  9. print('Correct')
  10. correct_answers += 1
  11. else:
  12. print ('Incorrect')
  13. print()
  14.  
  15. print('You got {} questions right.'.format(correct_answers))
Success #stdin #stdout 0.04s 9488KB
stdin
4
7
qwee
stdout
2+2 = ?
Correct

How many books in HP series?
Correct

Who is your mother?
Incorrect

You got 2 questions right.