Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. def partits(llista):
  2.     i = 1
  3.     maxPunts = llista[0][1] * 2 + llista[0][2]
  4.     maxI = 0
  5.  
  6.     while i < len(llista):
  7.         punts =  llista[i][1] * 2 + llista[i][2]
  8.  
  9.         if punts > maxPunts:
  10.             maxPunts = punts
  11.             maxI = i
  12.         elif punts == maxPunts:
  13.             difMax = llista[maxI][5] - llista[maxI][4]
  14.             difActual = llista[i][5] - llista[i][4]
  15.  
  16.             if difActual < difMax:
  17.                 maxPunts = punts
  18.                 maxI = i
  19.        
  20.         i += 1
  21.    
  22.     return llista[maxI][0]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement