[Tutor] compare
Shi Mu
samrobertsmith at gmail.com
Mon Oct 31 09:24:24 CET 2005
What does this line 11 mean in the following code?
1 # calc.py
2 def calc(seq):
3 maximum = 0
4 max_item = []
5 for i in seq:
6 product = (i[0]*100 + i[1]*10 + i[2]) * (i[3]*10 + i[4])
7 if product > maximum:
8 maximum = product
9 max_item = i
10 elif product == maximum:
11 max_item += ','+i
12 return max_item, maximum
13
14 seq = [ [5,6,7,8,9], [5,6,7,9,8] ]
15 max_item, maximum = calc(seq)
16 print "Maximum at", max_item, ",product", maximum
More information about the Tutor
mailing list