fork download
  1. # your code goes herex
  2.  
  3. x = [1,2,3,4,5]
  4.  
  5. x.sort()
  6.  
  7. k = 3
  8.  
  9. print("Maximum happiness =", sum(x[k-1:]))
  10.  
Success #stdin #stdout 0.13s 14116KB
stdin
Standard input is empty
stdout
Maximum happiness = 12