CBSE Class 11 Computer Science Question 65 of 82

Lists in Python — Question 30

Back to all questions
30
Question

Question 25

Write a code to calculate and display total marks and percentage of a student from the given list storing marks of a student.

Solution
marks_list = eval(input("Enter list of marks: "))
total_marks = sum(marks_list)
total_subjects = len(marks_list)
maximum_marks_per_subject = 100 
total_marks_possible = maximum_marks_per_subject * total_subjects
percentage = (total_marks / total_marks_possible) * 100

print("Total Marks:", total_marks)
print("Percentage:", percentage)
Output
Enter list of marks: [85, 90, 78, 92, 88]
Total Marks: 433
Percentage: 86.6
Answer