davegimo

federica3

Mar 4th, 2021
567
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. m = [['3', 'T', '7', None,'5', '1', '4',None],
  2.     ['2', '2', '2', None,'0', 'T', '7',None],
  3. [None,None,None,None,'3', '2', '1',None],
  4. [None,None,None,None,None,None,'1',None],
  5.      [None,None,None,None,None,None,'1','T']]
  6.  
  7.    
  8.    
  9. def media(m,pos):
  10.     return 2
  11.    
  12.    
  13.  
  14.  
  15. def contasoglie(m,s):
  16.     tavoli = []
  17.     for i in range(len(m)):
  18.         for j in range(len(m[i])):
  19.             if m[i][j] == 'T':
  20.                 tavoli.append((i,j))
  21.  
  22.     print(tavoli)
  23.    
  24.     conta = 0
  25.     for el in tavoli:
  26.         avg = media(m,el)
  27.         if avg > s:
  28.             conta += 1
  29.  
  30.     print(conta)
  31.     return conta
  32.    
  33.  
  34. contasoglie(m,1)
RAW Paste Data