The values from “testname.txt” has been appended to the following lists.
f = open ( “testname.txt” , “r” )
list1 = [ 20 , 40 , 60 , 80 , 40 ]
list2 = [ 50 , 60 , 70 , 40 , 30 , 60 ]
list3 = [ 40 , 60 , 70 , 80 , 30 , 50 ]
list4 = [ 20 , 50 , 60 , 70 , 40 , 60 ]
r = 0
for j in f:
if r = = 0 :
r = 1
k = j.split()
list_names = [] #will hold the list names
list_names.append(k[ 1 ])
list_names.append(k[ 2 ])
list_names.append(k[ 3 ])
list_names.append(k[ 4 ])
else :
w = j.split()
list_highest = []
list_highest.append(w[ 1 ])
list_highest.append(w[ 2 ])
list_highest.append(w[ 3 ])
list_highest.append(w[ 4 ])
print ( "The highest values of" ,list_names[j], "=" , max (list_highest)) `#, max(list_highest)) ==> is not working
Any alternates to find max() of each list elements?
Any help would be appreciated.
