50.1k views
5 votes
Write a Python program calculate summary statistics about a class assignment. First, prompt the user for the number scores to be entered. Then prompt for each score, re prompting for values outside the range 0 - 100. Finally, display the minimum, maximum and average scores. There is no need to keep a list of scores, they you may do so if you wish. Use good, meaningful variable names.

User Brynden
by
4.2k points

1 Answer

1 vote

Answer:

see explaination

Step-by-step explanation:

Code:

count = 0 num_of_sub = int(input("Enter a number of subjects : ")) marks_of_subjects = [] for i in range(num_of_sub): count = count + 1 while True: marks = int(input("Enter the marks for subject {} : ".format(count))) if marks < 0 or marks > 100: print("Marks are out of range: Try again") else: marks_of_subjects.append(marks) break Total = sum(marks_of_subjects) Min_marks = min(marks_of_subjects) Max_marks = max(marks_of_subjects) Average_marks = sum(marks_of_subjects)/len(marks_of_subjects) print("Total Marks in the exams are {} Marks".format(Total)) print("Minimum Score in the exam is {} Marks".format(Min_marks)) print("Maximum Score in the exam is {} Marks".format(Max_marks)) print("Average Score in the exam is {:.2f} Marks".format(Average_marks))

see attachment for the screenshot and output

Write a Python program calculate summary statistics about a class assignment. First-example-1
Write a Python program calculate summary statistics about a class assignment. First-example-2
User DuduArbel
by
4.6k points