CISC
Programming_assignment_2.py

# Programming_assignment_2.py -...

• Homework Help
• 7

This preview shows pages 1–4. Sign up to view the full content.

STUDENT_SCORE_FILENAME='student_data_prog2.txt' MID1_WEIGHT=0.1 MID2_WEIGHT=0.1 FINAL_WEIGHT=0.15 HW_WEIGHT = 0.05 LAB_WEIGHT = 0.3 PR1_WEIGHT = 0.08 PR2_WEIGHT = 0.08 PR3_WEIGHT = 0.09 PARTICIPATION_WEIGHT = 0.05 #Function to read student data and return lists after parsing def read_data (fname): names = [] student_year = [] mid1 = [] mid2 = [] final = [] HW = [] participation = [] for line in open (fname, 'r'): names.append(line.split()[0]) student_year.append(line.split()[1]) mid1.append(float(line.split()[15])) mid2.append(float(line.split()[16])) final.append(float(line.split()[17])) HW.append(float(line.split()[18])) participation.append(float(line.split()[19])) return names,mid1,mid2,final, HW, student_year,participation #Function to Display the Menu def show_instructions (): print ('------------------------------------------------------------------------------ --------------------------') print ('Welcome to the Student Score Statistics! This will allow you to find specific statistics of each student') print ('Type any of the following: ') print ('a for student lab average') print ('b for student programming assignment average') print ('c for weighted total score') print ('d for overall student grade') print ('e for sorted data') print ('s for additional statistics') #Function to compute average of a given list def avg(scores): total=0 count=0 for i in scores: total += i count += 1 return total/count #Function to computed weigted average of a student score

This preview has intentionally blurred sections. Sign up to view the full version.

if nmin> alist[i]: nmin = alist[i] elif nmax < alist[i]: nmax = alist[i] return(nmin, nmax) def student_data_list (name, fname): student_data = [] name_list,mid1,mid2,final,HW,student_year, participation = read_data(fname) lab_avg = avg(get_lab_grades(fname,name,name_list))

This preview has intentionally blurred sections. Sign up to view the full version.

This is the end of the preview. Sign up to access the rest of the document.
• Spring '08
• McGeary
• Weighted mean, Fname, Nmax

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern