MatteB_01

codice calciatori

Jan 27th, 2021
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. # this is an example of answer filling
  2. # i file specificati NON sono visibili direttamente, ma esistono e si possono aprire
  3. def main():
  4.    FILTRI = "filtri.txt"
  5.    SERIEA = "serieA.txt"
  6.    filtro = open(FILTRI, "r")
  7.    elenco = open(SERIEA, "r")
  8.    
  9.    calciatori = []
  10.    for line in elenco:
  11.       line = line.strip()
  12.       giocatore = line.split(" ")
  13.       calciatori.append(giocatore)
  14.  
  15.    esclusi = []
  16.    for line in filtro:
  17.       giocatore = line.strip()
  18.       esclusi.append(giocatore)
  19.  
  20.    filtro.close()
  21.    elenco.close()
  22.    
  23.    maxPresenze = 0
  24.    maxGiocatore = ""
  25.    minPresenze = 99999999999
  26.    minGiocatoe = ""
  27.    
  28.    for i in calciatori:
  29.       giocatore = i[0] + " " + i[1]
  30.       if giocatore not in esclusi:
  31.          giocatore += " " + i[2] + " " + i[3] + " " + i[4]
  32.          print(giocatore)
  33.      
  34.       presenze = int(i[2])
  35.       if presenze > maxPresenze:
  36.           maxPresenze = presenze
  37.           maxGiocatore = i[2] + " " + i[0] + " " + i[1]
  38.       elif presenze < minPresenze:
  39.           minPresenze = presenze
  40.           maxGiocatore =  i[2] + " " + i[0] + " " + i[1]
  41.      
  42.    print(f"presenze min: {minPresenze}")
  43.    print(f"presenze max: {maxPresenze}")
  44. main()
Advertisement
Add Comment
Please, Sign In to add comment