I am a newbie to python programming. I am working on a class homework and got the code below so far. The next step that am struggling with is to write a function the would show / print the lowest score and average score. Any direction would be much appreciated.
scores = """Aturing:Mark$86:
Inewton:Mark$67.5:
Cdarwin:Mark$90:
Fnightingale:Mark$99:
Cvraman:Mark$10:"""
students = {}
for studentdata in scores.split('\n'):
data = studentdata.split(':')
name = data[0]
students[name] = {}
for class_data in data[1:]:
if class_data:
Mark,class_score = class_data.split('$')
students[name][Mark] = class_score
def Grade_Show(student,Mark):
if student in students:
if Mark in students[student]:
print "Student %s got %s in the assignment %s" % (student,students[student][Mark],Mark)
else:
print "subject %s not found for student %s" % (Mark,student)
else:
print "student %s not found" % (student)
#do some testing
Grade_Show("Inewton","Mark")