I am writing a code that prints a student's grade according to the number of questions he hits. But I need the program to do the calculation in a specific amount of times. The program should receive the number of questions in the test, the feedback of the test (the proof is objective), the number of students who took the test and the response of each student. The program must print the note of each student, and the student receives 1 point for the correct question. Example:
Entry:
5
ABCDD
2
ABCDD
ACCDE
Output:
5
3
Another example:
Entry:
3
DAA
3
ABA
DDA
BBC
Output:
1
2
0
How do I do:
questões = int(raw_input())
gabarito = raw_input()
alunos = int(raw_input())
resposta = raw_input()
nota = 0
for i in resposta:
if i == r in gabarito:
nota = nota + 1
print nota
My difficulty is in getting the code to receive the specified number of entries. Would it work fine by defining a function, or does it not? How to proceed?