a,y = map(int, input().split())
scores = [map(float, input().split()) for _ in range(y)]
[print(sum(student)/y) for student in zip(*scores)]
this code is supposed to take inputs : no. of students, no. of subjects and marks scored in each one of them and then give average of all students. i have two questions:
- how is map() method able to take 2 variables i am new to programming so as far as i know to give values to multiple variables at the same time you need to separate them with commas(not done in the above situation) how does that work.
- how is there a variable student in the code when it is not even defined and still works perfectly?
this code was a solution to a beginnner level problem in hackerrank