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. 

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.

For example:
```
checkExam(["a", "a", "b", "b"], ["a", "c", "b", "d"]) → 6
checkExam(["a", "a", "c", "b"], ["a", "a", "b",  ""]) → 7
checkExam(["a", "a", "b", "c"], ["a", "a", "b", "c"]) → 16
checkExam(["b", "c", "b", "a"], ["",  "a", "a", "c"]) → 0
```

Difficulty: EASY
Tags: Fundamentals

Data structures
Skill types: Data structures

Starter code:
def check_exam(arr1,arr2):
	

Solutions:
def check_exam(arr1, arr2):
	return max(0, sum((4 if a == b else -1 for (a, b) in zip(arr1, arr2) if b)))


def check_exam(arr1, arr2):
	score = 0
	for i in range(0, 4):
		if arr1[i] == arr2[i]:
			score += 4
		elif arr1[i] == '' or arr2[i] == '':
			score += 0
		else:
			score -= 1
	return score if score >= 0 else 0


def check_exam(arr1, arr2):
	score = 0
	for i in range(len(arr1)):
		if arr2[i] != '':
			if arr2[i] == arr1[i]:
				score = score + 4
			else:
				score = score - 1
	return score if score > 0 else 0


NOTATION = {True: 4, False: -1}

def check_exam(ref, ans):
	return max(0, sum((NOTATION[r == a] for (r, a) in zip(ref, ans) if a)))


def check_exam(arr1, arr2):
	k = 0
	for x in range(len(arr1)):
		if arr2[x] != '':
			if arr1[x] == arr2[x]:
				k += 4
			else:
				k -= 1
	if k < 1:
		return 0
	return k


def check_exam(answers, solutions):
	return max(sum(([0, -1, 4][(ans == sol) + (sol != '')] for (ans, sol) in zip(answers, solutions))), 0)


def check_exam(arr1, arr2):
	score = 0
	for i in range(0, len(arr1)):
		if arr1[i] == arr2[i]:
			score = score + 4
		elif arr2[i] != '':
			score -= 1
	return max(score, 0)


def check_exam(arr1, arr2):
	x = sum([4 if arr1[i] == arr2[i] else 0 if arr2[i] == '' else -1 for i in range(len(arr1))])
	return 0 if x < 0 else x


def check_exam(arr1, arr2):
	total = 0
	for (x, y) in zip(arr1, arr2):
		if y == '':
			continue
		elif x == y:
			total += 4
		else:
			total -= 1
	return total if total > 0 else 0


def check_exam(arr1, arr2):
	score = 0
	for (n, a) in enumerate(arr2):
		if a != '':
			if a == arr1[n]:
				score += 4
			else:
				score -= 1
	return max(score, 0)


def check_exam(arr1, arr2):
	score = 0
	while True:
		for i in range(len(arr2)):
			if arr1[i] == arr2[i]:
				score += 4
			elif arr2[i] == '':
				score += 0
			else:
				score -= 1
		if score < 0:
			return 0
		return score


def check_anwser(actual, expected):
	if not actual:
		return 0
	return 4 if actual == expected else -1

def check_exam(arr1, arr2):
	return max(0, sum(map(check_anwser, arr2, arr1)))


def check_exam(arr1, arr2):
	point = 0
	for e in list(zip(arr1, arr2)):
		point += 4 if e[0] == e[1] else 0 if e[1] == '' else -1
	return 0 if point < 0 else point


def check_exam(arr1, arr2):
	a = sum((4 if x == y else -1 if y else 0 for (x, y) in zip(arr1, arr2)))
	return a if a > 0 else 0


def check_exam(arr1, arr2):
	score = 0
	for i in range(0, len(arr1)):
		if not arr2[i]:
			continue
		if arr1[i] == arr2[i]:
			score += 4
		elif arr1[i] != arr2[i]:
			score -= 1
	if score < 0:
		score = 0
	return score


def check_exam(arr1, arr2):
	ans = sum([4 if ca == sa else 0 if sa == '' else -1 for (ca, sa) in zip(arr1, arr2)])
	return ans if ans > 0 else 0


def check_exam(*arr):
	return max(0, sum(([-1, 4][a == b] if b else 0 for (a, b) in zip(*arr))))


def check_exam(arr1, arr2):
	return max(0, sum([4 if arr2[i] == x else 0 if arr2[i] == '' else -1 for (i, x) in enumerate(arr1)]))


def check_exam(arr1, arr2):
	score = sum((4 if a == arr1[i] else 0 if not a else -1 for (i, a) in enumerate(arr2)))
	return 0 if score < 0 else score


def check_exam(arr1, arr2):
	result = []
	for i in range(len(arr1)):
		if arr2[i] == '':
			result.append(0)
		elif arr1[i] == arr2[i]:
			result.append(4)
		else:
			result.append(-1)
	return sum(result) if sum(result) > 0 else 0


def check_exam(arr1, arr2):
	score = 0
	for (elt1, elt2) in zip(arr1, arr2):
		if not elt2:
			pass
		elif elt1 == elt2:
			score += 4
		else:
			score -= 1
	return max(score, 0)


def check_exam(arr1, arr2):
	score = 0
	for (i, j) in zip(arr1, arr2):
		if i == j:
			score += 4
		if j == '' and i != '':
			score += 0
		if i != '' and j != '' and (i != j):
			score -= 1
	if score < 0:
		return 0
	else:
		return score


def check_exam(a1, a2):
	return max(0, sum((4 if i == j else -1 for (i, j) in zip(a1, a2) if j)))


def check_exam(arr1, arr2):
	return max(0, sum(((arr1[i] == arr2[i]) * 5 - 1 for i in range(len(arr1)) if arr2[i] != '')))


def check_exam(arr1, arr2):
	return max(0, sum((4 if a1 == a2 else -1 for (a1, a2) in zip(arr1, arr2) if a2)))


def check_exam(a, b):
	res = sum(map(lambda x: 0 if x[1] == '' else 4 if x[0] == x[1] else -1, zip(a, b)))
	return 0 if res < 0 else res


def check_exam(arr1, arr2):
	a = sum([4 if arr1[x] == arr2[x] else -1 if arr2[x] is not '' else 0 for x in range(len(arr1))])
	return a if a >= 0 else 0


def check_exam(a, b):
	return max(0, sum(((a[i] == b[i]) * 5 - 1 for i in range(len(a)) if b[i])))


def check_exam(a, b):
	return max(0, sum(([4, -1, 0][(x != y) + (y == '')] for (x, y) in zip(a, b))))


check_exam = lambda e, a: max(0, sum((4 * (x == y) or -1 for (x, y) in zip(e, a) if y)))


def check_exam(correc, copie):
	return max(0, sum(((not not reponse) * (5 * (reponse == vrai) - 1) for (vrai, reponse) in zip(correc, copie))))


def check_exam(arr1, arr2):
	q = 0
	for (i, j) in zip(arr1, arr2):
		if i == j:
			q += 4
		elif i != j and j != '':
			q -= 1
	if q > 0:
		return q
	else:
		return 0


from typing import List

def check_exam(arr1: List[str], arr2: List[str]) -> int:
	_exam_points_sum = sum([0 if not _it[1] else 4 if _it[0] == _it[1] else -1 for _it in zip(arr1, arr2)])
	return _exam_points_sum if _exam_points_sum > 0 else 0


def check_exam(arr1, arr2):
	if check0(arr1, arr2) + check1(arr1, arr2) + check2(arr1, arr2) + check3(arr1, arr2) + minus(arr1, arr2) < 0:
		return 0
	else:
		return check0(arr1, arr2) + check1(arr1, arr2) + check2(arr1, arr2) + check3(arr1, arr2) + minus(arr1, arr2)

def minus(arr1, arr2):
	arr0 = [i for i in arr2 if len(i) == 0]
	return 0 * len(arr0)

def check0(arr1, arr2):
	if arr1[0] == arr2[0]:
		return +4
	elif len(arr2[0]) == 0:
		return 0
	else:
		return -1

def check1(arr1, arr2):
	if arr1[1] == arr2[1]:
		return +4
	elif len(arr2[1]) == 0:
		return 0
	else:
		return -1

def check2(arr1, arr2):
	if arr1[2] == arr2[2]:
		return +4
	elif len(arr2[2]) == 0:
		return 0
	else:
		return -1

def check3(arr1, arr2):
	if arr1[3] == arr2[3]:
		return +4
	elif len(arr2[3]) == 0:
		return 0
	else:
		return -1


def check_exam(arr1, arr2):
	sum = 0
	i = 0
	while i < len(arr1):
		if arr1[i] == arr2[i]:
			sum = sum + 4
			i = i + 1
			continue
		elif arr2[i] == '':
			sum = sum
			i = i + 1
			continue
		else:
			sum = sum - 1
			i = i + 1
	if sum < 0:
		sum = 0
		return sum
	else:
		return sum


def check_exam(arr1, arr2):
	points = 0
	for (a, b) in zip(arr1, arr2):
		if a == b:
			points += 4
		elif b and 1 != b:
			points -= 1
	return points if points > 0 else 0


def check_exam(arr1, arr2):
	score = 0
	for s in range(0, len(arr1)):
		for a in range(0, len(arr2)):
			if s == a:
				if arr1[s] == arr2[a]:
					score += 4
				elif arr2[a] == '':
					score += 0
				elif arr1[s] != arr2[a]:
					score -= 1
	if score < 0:
		return 0
	else:
		return score


def check_exam(arr1='', arr2=''):
	x = 0
	for i in range(0, len(arr2), 1):
		if arr1[i] == arr2[i]:
			x = x + 4
		elif arr2[i] != arr1[i] and arr2[i] != '':
			x = x - 1
		else:
			x = x
	if x <= 0:
		return 0
	else:
		return x


def check_exam(arr1, arr2):
	n = len(arr1)
	score = 0
	while n > 0:
		n -= 1
		if arr2[n] == '':
			score = score
		elif arr2[n] == arr1[n]:
			score += 4
		else:
			score -= 1
	return max(score, 0)


def check_exam(arr1, arr2):
	exam_score = 0
	for index in range(0, len(arr1)):
		if arr1[index] == arr2[index]:
			exam_score += 4
		elif arr1[index] != arr2[index]:
			if arr2[index] == '':
				exam_score += 0
			else:
				exam_score -= 1
	if exam_score < 0:
		return 0
	else:
		return exam_score


def check_exam(answer_sheet, test):
	score = 0
	for (correct, answer) in zip(answer_sheet, test):
		if not answer:
			continue
		score += 4 if correct == answer else -1
	return max(0, score)


def check_exam(arr1: list, arr2: list) -> int:
	count = 0
	for i in range(len(arr2)):
		if arr2[i] == arr1[i]:
			count += 4
		elif arr2[i] != arr1[i] and (not len(arr2[i]) == 0):
			count -= 1
	return count if count > 0 else 0


def check_exam(arr1, arr2):
	finalmark = 0
	for i in range(len(arr1)):
		if arr1[i] == arr2[i]:
			finalmark += 4
		if arr1[i] != arr2[i] and arr2[i] != '':
			finalmark -= 1
	if finalmark < 0:
		finalmark = 0
	return finalmark


def check_exam(arr1, arr2):
	ret = 0
	for pair in zip(arr1, arr2):
		if pair[1] == '':
			continue
		ret += 4 if pair[0] == pair[1] else -1
	return max(0, ret)


def check_exam(arr1, arr2):
	result = []
	for (a, b) in zip(arr1, arr2):
		if a == b:
			result.append(4)
		elif len(a) != len(b):
			result.append(0)
		elif a != b:
			result.append(-1)
	score = sum(result)
	if score < 0:
		return 0
	else:
		return score


def check_exam(arr1, arr2):
	mark = 0
	for (a1, a2) in zip(arr1, arr2):
		if a1 == a2:
			mark += 4
		elif a1 != a2 and a2 != '':
			mark -= 1
	return 0 if mark < 0 else mark


def check_exam(arr1, arr2):

	def grade(a, b):
		if not b:
			return 0
		if a == b:
			return 4
		if a != b:
			return -1
	s = sum(map(lambda x, y: grade(x, y), arr1, arr2))
	return s if s > 0 else 0


def check_exam(a1, a2):
	s = 0
	for (x, z) in zip(a1, a2):
		if not z:
			pass
		elif x == z:
			s += 4
		else:
			s -= 1
	return s if s >= 0 else 0


def check_exam(arr1, arr2):
	iterator = 0
	score = 0
	while iterator < 4:
		if arr1[iterator] == arr2[iterator]:
			score = score + 4
			iterator = iterator + 1
		elif arr1[iterator] != arr2[iterator] and arr2[iterator] != '':
			score = score - 1
			iterator = iterator + 1
		else:
			iterator = iterator + 1
	if score < 0:
		score = 0
	return score


def check_exam(arr1, arr2):
	score = 0
	for (c, s) in zip(arr1, arr2):
		if s == '':
			score += 0
		elif s == c:
			score += 4
		else:
			score -= 1
	return score if score > 0 else 0


def check_exam(arr1, arr2):
	score = 0
	for x in range(len(arr2)):
		if arr1[x] == arr2[x]:
			score += 4
		elif arr2[x] == '':
			pass
		else:
			score -= 1
	if score < 0:
		return 0
	return score


def check_exam(arr1, arr2):
	sum = 0
	for (i, j) in zip(arr1, arr2):
		if j == '':
			sum += 0
		elif i == j:
			sum += 4
		else:
			sum += -1
	if sum < 0:
		return 0
	else:
		return sum


def check_exam(arr1, arr2):
	c = 0
	for i in range(len(arr1)):
		if arr1[i] == arr2[i]:
			c += 4
		elif arr2[i] == '':
			c += 0
		else:
			c -= 1
	if c < 0:
		return 0
	else:
		return c


def check_exam(arr1, arr2):
	point = 0
	for (x, y) in zip(arr1, arr2):
		if x != y:
			if y != '':
				point -= 1
			else:
				point = point + 0
		elif x == y:
			point += 4
	if point < 0:
		return 0
	else:
		return point


def check_exam(arr1, arr2):
	i = 0
	result = 0
	while i < len(arr1):
		if arr1[i] == arr2[i]:
			result = result + 4
		elif arr2[i] == '':
			result = result + 0
		else:
			result = result - 1
		i = i + 1
	if result < 0:
		return 0
	else:
		return result


def check_exam(arr1, arr2):
	corr = 0
	blank = 0
	for n in range(4):
		if arr2[n] == arr1[n] and arr2[n] != '':
			corr += 1
		elif arr2[n] == '':
			blank += 1
	return 4 * corr - (4 - corr - blank) if 4 * corr - (4 - corr - blank) > 0 else 0


def check_exam(arr1, arr2):
	score = 0
	for (key, ans) in zip(arr1, arr2):
		if key == ans:
			score += 4
		elif ans != '' and ans != key:
			score -= 1
	return score if score > 0 else 0


def check_exam(arr1, arr2):
	score = 0
	for x in range(len(arr1)):
		if arr1[x] == arr2[x]:
			score += 4
		elif arr2[x] != '' and arr2[x] != arr1[x]:
			score -= 1
	if score < 0:
		score = 0
	return score


def check_exam(arr1, arr2):
	sum = 0
	for grade in range(len(arr1)):
		if arr1[grade] == arr2[grade]:
			sum += 4
		elif arr2[grade] == '':
			sum += 0
		else:
			sum -= 1
	return sum if sum > 0 else 0


def check_exam(arr1, arr2):
	grade = 0
	counter = len(arr1)
	scores = 0
	while scores < counter:
		if arr1[scores] == arr2[scores]:
			grade = grade + 4
		elif arr1[scores] == '' or arr2[scores] == '':
			grade = grade + 0
		else:
			grade = grade - 1
		scores += 1
	if grade < 0:
		return 0
	else:
		return grade


import numpy

def check_exam(arr1, arr2):
	result = 0
	for i in range(len(arr2)):
		if arr1[i] == arr2[i]:
			result += 4
		else:
			result -= 1
	result += arr2.count('')
	return 0 if result < 0 else result


def check_exam(arr1, arr2):
	liste = []
	for (i, x) in enumerate(arr1):
		y = arr2[i]
		if x != y:
			if y == '':
				liste.append(0)
			else:
				liste.append(-1)
		else:
			liste.append(4)
	x = sum(liste)
	if x < 0:
		return 0
	else:
		return x


def check_exam(arr1, arr2):
	score = 0
	for (i, j) in zip(arr1, arr2):
		if j == '':
			continue
		elif i == j:
			score += 4
		elif i != j:
			score -= 1
		else:
			pass
	if score <= 0:
		return 0
	else:
		return score
	pass


def check_exam(arr1, arr2):
	score = 0
	for i in range(len(arr1)):
		validAnswer = arr1[i]
		studentAnswer = arr2[i]
		if studentAnswer == '':
			continue
		if studentAnswer == validAnswer:
			score += 4
		else:
			score -= 1
	if score < 0:
		return 0
	else:
		return score
	pass


def check_exam(arr1, arr2):
	points = 0
	for n in range(len(arr1)):
		if arr2[n] != '':
			if arr1[n] == arr2[n]:
				points = points + 4
			else:
				points = points - 1
	if points < 0:
		points = 0
	return points


def check_exam(arr1, arr2):
	print((arr1, arr2))
	i = 0
	result = []
	while i < len(arr1):
		if arr1[i] == arr2[i]:
			result.append(4)
		elif arr2[i] == '':
			result.append(0)
		else:
			result.append(-1)
		i += 1
	return sum(result) if sum(result) > 0 else 0


def check_exam(arr1, arr2):
	score0 = 0
	score1 = 0
	score2 = 0
	score3 = 0
	if arr1[0] == arr2[0]:
		score0 = 4
	elif arr2[0] == '':
		score0 = 0
	elif arr1[0] != arr2[0]:
		score0 = -1
	if arr1[1] == arr2[1]:
		score1 = 4
	elif arr2[1] == '':
		score1 = 0
	elif arr1[1] != arr2[1]:
		score1 = -1
	if arr1[2] == arr2[2]:
		score2 = 4
	elif arr2[2] == '':
		score2 = 0
	elif arr1[2] != arr2[2]:
		score2 = -1
	if arr1[3] == arr2[3]:
		score3 = 4
	elif arr2[3] == '':
		score3 = 0
	elif arr1[3] != arr2[3]:
		score3 = -1
	totalscore = score0 + score1 + score2 + score3
	if totalscore < 0:
		return 0
	else:
		return totalscore