Please use code tags for your code.
You are getting close, but you need to find if the score is a new minimum or maximum each time through the loop. Something like this:
infile = open("test_scores.dat", "r")
mylist = infile.readlines()
infile.close()
# remove the header, first item in the list
del mylist[0]
max_score = 0
min_score = 100
for line in mylist:
# split each line into a list at space/whitespace and unpack
last_name, first_name, ID, score = line.split()
# for testing only
print last_name, first_name, ID, score
# create integer scores
if score.isdigit():
score = int(score)
# check if it is a new max
if score > max_score:
max_score = score
# check if it is a new min
elif score < min_score:
min_score = score
Then just print out the max_score and min_score results.
Please study the code and the comments!
sneekula
Nearly a Posting Maven
2,427 posts since Oct 2006
Reputation Points: 961
Solved Threads: 212