Guest User

Untitled

a guest
Feb 16th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. def common_argument(M):
  2. element = M[0][4]
  3. for i in range(len(M)):
  4. if M[i][4] != element:
  5. if period(M, element) < period(M, M[i][4]):
  6. element = M[i][4]
  7. return element
  8.  
  9.  
  10.  
  11. def period(M,c):
  12. s = 0
  13. for i in range(len(M)):
  14. if c in M[i]:
  15. if M[i][2] != M[i][3]:
  16. if M[i][2] > M[i][3]:
  17. s += M[i][2] - M[i][3]
  18. if M[i][3] > M[i][2]:
  19. s += M[i][3] - M[i][2]
  20. return s
  21.  
  22.  
  23. common_argument([[10, 1, 15, 17, 'Vendite'],
  24. [10, 1, 17, 18, 'Progetti'],
  25. [16, 2, 10, 12, 'Vendite'],
  26. [16, 2, 13, 15, 'Progetti'],
  27. [5,3,10, 13, 'Progetti']])
Add Comment
Please, Sign In to add comment