[Ilugc] [PYTHON] sum of best two scores of three

  • From: lawgon@xxxxxxxxxxxxxxx (kenneth gonsalves)
  • Date: Sat, 31 Dec 2011 10:59:00 +0530

hi,

a team of 3 people are playing. We need the sum of the best two scores.

scores = [5,2,3]
scores.pop(scores.index(min(scores)))
2
sum(scores)
8

can this be done in one line? (first line which initialises the variable
is not counted).

-- 
regards
Kenneth Gonsalves

-- 
regards
Kenneth Gonsalves


Other related posts: