#test: #5 questions #indicators 1 1 2 1 2 #student/correct #1 2 #0 1 #2 2 #3 3 #0 5 #Total on all questions -1 -0.5+5 +3-1=5.5 points #Total for MATH only -1-0.5+3=1.5 #Total for ENGLS only 5-1= 4 #Average for MATH 1.5/3 = 0.5 #Average for ENGL 4/2 = 2 def math_score(st_answ, cor_answ): if(st_answ==0): points=-0.5 elif(st_answ==cor_answ): points=3 elif(st_answ!=cor_answ): points=-1 return points def engl_score(st_answ, cor_answ): if(st_answ==0): points=-1 elif(st_answ==cor_answ): points=5 elif(st_answ!=cor_answ): points=-2 return points def main(): num_q=int(input("how many questions ")) total_math=0 total_engl=0 num_math=0 num_engl=0 for i in range(num_q): indicator=int(input("1 - MATH 2 - ENGLS ")) student=int(input("enter student answer ")) correct=int(input("enter correct answer ")) if(indicator==1): num_math+=1 total_math=total_math+math_score(student, correct) elif(indicator==2): num_engl+=1 total_engl+=engl_score(student, correct) else: print("wrong indicator") if(num_math>0): print("total math score is", total_math) print("average math score is", total_math/num_math) else: print("NO MATH") if(num_engl>0): print("total ENGL score is", total_engl) print("average ENGL score is", total_engl/num_engl) else: print("NO ENLG") main()