KnowledgeBoat Logo

Computer Science

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

Python

Python List Manipulation

7 Likes

Answer

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

Answered By

5 Likes


Related Questions