From 1fe81696147012e9023491a40b6ad645adbc0630 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Thu, 4 May 2017 15:09:27 +0200 Subject: Redefined attr id in idGiocatore --- python/carte.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/python/carte.py b/python/carte.py index 23878f1..706e8cd 100644 --- a/python/carte.py +++ b/python/carte.py @@ -1,6 +1,6 @@ class punteggioGiocatori: - def __init__(self, id, punteggio): - self.id = id + def __init__(self, idGiocatore, punteggio): + self.idGiocatore = idGiocatore self.punteggio = punteggio @@ -18,12 +18,12 @@ with open('input.txt', 'r') as fin: rID = -1 for j in range(N): - if players[j].id == futID: + if players[j].idGiocatore == futID: rID = j break if rID == -1: - players[last].id = futID + players[last].idGiocatore = futID players[last].punteggio = futPunteggio last += 1 @@ -38,13 +38,13 @@ while(s): for k in range(last): if players[k].punteggio < players[k+1].punteggio: - t[0] = players[k].id + t[0] = players[k].idGiocatore t[1] = players[k].punteggio - players[k].id = players[k + 1].id + players[k].idGiocatore = players[k + 1].idGiocatore players[k].punteggio = players[k + 1].punteggio - players[k + 1].id = t[0] + players[k + 1].idGiocatore = t[0] players[k + 1].punteggio = t[1] s = True @@ -53,4 +53,4 @@ while(s): with open('output.txt', 'w') as fout: - fout.write(str(players[0].id) + ' ' + str(players[0].punteggio)) \ No newline at end of file + fout.write(str(players[0].idGiocatore) + ' ' + str(players[0].punteggio)) -- cgit v1.2.3-18-g5258