The two arrays are not empty and are the same length. Return the score for this array of answers, giving +4 for each correct answer, -1 for each incorrect answer, and +0 for each blank answer, represented as an empty string (in C the space character is used).
If the score < 0, return 0.
The first input array is the key to the correct answers to an exam, like ["a", "a", "b", "d"]. The second one contains a student's submitted answers.
This is my code, however is not working!! can someone assist me?
def check_exam(arr1,arr2):
res = 0
for i in arr1:
for j in arr2:
if [i] == [j]:
res+=4
elif i=='':
res==0
elif j=='':
res==0
else:
res+=-1
return res
Example:
checkExam(["a", "a", "b", "b"], ["a", "c", "b", "d"])
→ 6