human
Find the total marks obtained according to given marking scheme | Function that calculates marks ..
for not attempt score + 0.
for each correct answer score + 3.
for each wrong answer score - 1.
calculate total marks.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to find the total marks obtained according to given marking scheme and the other steps required.
 def markingScheme ( N , answerKey , studentAnswer ) :
	positive = 0
	negative = 0
	notattempt = 0
	for i in range ( 0 , N ) :
		if ( studentAnswer [ i ] == 0 ) :
			notattempt += 1
		elif ( answerKey [ i ] == studentAnswer [ i ] ) :
			positive += 1
		elif ( answerKey [ i ] != studentAnswer [ i ] ) :
			negative += 1
	return ( positive * 3 ) + ( negative * - 1 )
def main ( ) :
	answerKey = [ 1 , 2 , 3 , 4 , 1 ]
	studentAnswer = [ 1 , 2 , 3 , 4 , 0 ]
	N = 5
	print ( markingScheme ( N , answerKey , studentAnswer ) )