Computer Science, asked by SherwinJ, 1 year ago

Write a program to accept name and total marks of N number of students in two single subscript arrays name [ ] and totalmarks [ ].
Calculate and print:
1. The average of the total mark obtained by N number of students.
[Average =(sum of total marks of all students)/N]
2. Deviation of each student's total marks with the average.
[Deviation=total marks of a student -average]

Answers

Answered by fiercespartan
5

In this program, we will need to have two lists, marks and names and we need to find the average and deviation.

I will be using simple functions:

(1) sum() --- sums up a list

(2) len() --- Finds the total length

(3) split() --- splits a string

_________________________________________

CODE:

Names = list(map(str,input('Enter names separated by a comma').split(',')))

Marks = list(map(int,input("Enter marks separated by a comma").split(',')))

Average = round(sum(Marks)/ len(Marks))

print(f'Average: {Average}')

print(f'Deviation: {sum(Marks) - Average}')

_________________________________________

Similar questions