Question

3.12 Grade Statistics Write a python module "school.py" that prints school information (first 3 lines of...

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:

  • imports "school.py"
  • reads 5 midterm scores from the user into a list and then displays the list
  • reads 5 final scores from the user into a list and then displays the list
  • prints the number of students who took the midterm
  • prints the range of midterm scores
  • prints the average midterm score
  • prints the number of students who took the final
  • prints the range of final scores
  • prints the average final score

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

Homework Answers

Answer #1

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))

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT