3.12 Grade Statistics
Write a python module "school.py" that prints school information (first 3 lines of output). Write a python script "grades.py" that does the following:
Output should look like the following:
University of Montana 32 Campus Drive Missoula, Montana 59801 CSCI 135 MIDTERM SCORES: Enter 1st midterm score: 70 Enter 2nd midterm score: 80 Enter 3rd midterm score: 90 Enter 4th midterm score: 80 Enter 5th midterm score: 80 [70, 80, 90, 80, 80] FINAL SCORES: Enter 1st final score: 75 Enter 2nd final score: 85 Enter 3rd final score: 95 Enter 4th final score: 85 Enter 5th final score: 75 [75, 85, 95, 85, 75] 5 students took the midterm. Midterm scores ranged from 70 to 90 Average midterm: 80.0 5 students took the final. Final scores ranged from 75 to 95 Average final: 83.0
What I have so far is a school.py file with the address and then this:
import School
midterm = []
midterm.append(int(input('Enter 1st midterm score: ')))
midterm.append(int(input('Enter 2nd midterm score: ')))
midterm.append(int(input('Enter 3rd midterm score: ')))
midterm.append(int(input('Enter 4th midterm score: ')))
midterm.append(int(input('Enter 5th midterm score: ')))
But from here I'm a little lost
If you have any doubts, please give me comment...
school.py
def school_info():
print("University of Montana")
print("32 Campus Drive")
print("Missoula, Montana 59801")
print("\nCSCI 135")
grades.py
from school import school_info
school_info()
print("\nMIDTERM SCORES:")
midterm = []
for i in range(1, 6):
score = int(input("Enter "+str(i)+"st midterm score: "))
midterm.append(score)
print(midterm)
print("\nFINAL SCORES:")
final = []
for i in range(1, 6):
score = int(input("Enter "+str(i)+"st final score: "))
final.append(score)
print(final)
no_students = len(midterm)
average_mid = sum(midterm)/no_students
print("\n"+str(len(midterm))+" students took the midterm.")
print("Midterm scores ranged from "+str(min(midterm))+" to "+str(max(midterm)))
print("Average midterm: "+str(average_mid))
no_students = len(final)
average_final = sum(final)/no_students
print("\n"+str(len(final))+" students took the final.")
print("Final scores ranged from "+str(min(final))+" to "+str(max(final)))
print("Average final: "+str(average_final))
Get Answers For Free
Most questions answered within 1 hours.