Program for Cumulative Average -
Question - Write a program that asks the user to enter a student's name and 8 numeric assignment scores. The program should output the student's name, a letter grade for each assignment score, and cumulative average for all the assignments. Please note, there are 12 students in the class so your program will need to be able to either accept data for 12 students or loop 12 times in order to process all the students in the class.
ORDER NEW PROGRAM FOR CUMULATIVE AVERAGE - PYTHON ASSIGNMENT AT NOMINAL PRICE!
Answer - REPORT
Marks.py Source Code:
def calc_average(m1, m2, m3, m4, m5, m6, m7, m8): # method to calculate average of marks
avg = (m1 + m2 + m3 + m4 + m5 + m6 + m7 + m8)/8;
return avg
def determine_grade(marks): # method to find the letter grade of marks
if int(marks) >= 90 and int(marks) <= 100 :
grade = "A"
elif int(marks) >= 80 and int(marks) <= 89:
grade = "B"
elif int(marks) >= 70 and int(marks) <= 79:
grade = "C"
elif int(marks) >= 60 and int(marks) <= 69:
grade = "D"
else:
grade = "F"
return grade
def main():
# create a nested list to store student data
student = [
['Lucy Miller', 45, 69, 70, 66, 87, 82, 75, 73],
['Frank Jones', 90, 93, 87, 84, 91, 93, 90, 88],
['Nancy Franklin', 99, 97, 92, 90, 88, 89, 87, 90],
['Judy Forsyth', 72, 86, 59, 69, 72, 78, 80, 82],
['Tony Spirit', 87, 83, 86, 90, 79, 76, 80, 88],
['Ruth Ames', 66, 69, 72, 61, 69, 73, 71, 70],
['John Smith', 100, 98, 89, 93, 82, 86, 91, 93],
['Andrew Barnes', 78, 77, 75, 83, 80, 87, 80, 78],
['Becky Stone', 98, 94, 90, 89, 84, 83, 79, 93],
['Marvin Decker', 59, 54, 61, 45, 39, 66, 70, 72],
['Steve Parker', 71, 78, 73, 62, 66, 72, 64, 70],
['Frank Harper', 89, 86, 90, 92, 91, 85, 88, 93]
]
for i in range(len(student)): # run the for loop for students
sname = student[i][0] # store student name and marks into variable getting data from the list defined above
m1 = student[i][1]
m2 = student[i][2]
m3 = student[i][3]
m4 = student[i][4]
m5 = student[i][5]
m6 = student[i][6]
m7 = student[i][7]
m8 = student[i][8]
# call the calc_average() method to find the average of marks
stuavg = calc_average(int(m1),int(m2),int(m3),int(m4),int(m5),int(m6),int(m7),int(m8))
ltrgrd1 = determine_grade(m1) # call the determine_grade() method to find the letter grade for each 8 marks
ltrgrd2 = determine_grade(m2)
ltrgrd3 = determine_grade(m3)
ltrgrd4 = determine_grade(m4)
ltrgrd5 = determine_grade(m5)
ltrgrd6 = determine_grade(m6)
ltrgrd7 = determine_grade(m7)
ltrgrd8 = determine_grade(m8)
# print the student record -student name, letter grade of each marks and average marks
print("%s \t %s %s %s %s %s %s %s %s %.2f" % (sname, ltrgrd1, ltrgrd2, ltrgrd3, ltrgrd4, ltrgrd5, ltrgrd6, ltrgrd7, ltrgrd8, stuavg))
print()
main()
GET BENEFITTED WITH QUALITY PROGRAM FOR CUMULATIVE AVERAGE - PYTHON ASSIGNMENT HELP SERVICE OF EXPERTSMINDS.COM!
OUTPUT SCREEN:
Python 3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:25:24) [MSC v.1900 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.
IPython 5.3.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
Populating the interactive namespace from numpy and matplotlib
Lucy Miller F D C D B B C C 70.88
Frank Jones A A B B A A A B 89.50
Nancy Franklin A A A A B B B A 91.50
Judy Forsyth C B F D C C B B 74.75
Tony Spirit B B B A C C B B 83.62
Ruth Ames D D C D D C C C 68.88
John Smith A A B A B B A A 91.50
Andrew Barnes C C C B B B B C 79.75
Becky Stone A A A B B B C A 88.75
Marvin Decker F F D F F D C C 58.25
Steve Parker C C C D D C D C 69.50
Frank Harper B B A A A B B A 89.25
ORDER NEW COPY OF PROGRAM FOR CUMULATIVE AVERAGE - PYTHON ASSIGNMENT & GET HIGH QUALITY SOLUTIONS FROM SUBJECT'S TUTORS!