Skip to content

Commit a9e39b5

Browse files
persone
1 parent d599987 commit a9e39b5

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

persona.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
logger = logging.getLogger(__name__)
66

77
class Persona(metaclass=ABCMeta):
8-
def __init__(self,nome, cognome, data_nascita):
8+
def __init__(self,nome, cognome, data_nascita, sesso, peso):
99
self._nome=nome
1010
self._cognome=cognome
1111
self._data_nascita=data_nascita
12+
self.sesso=sesso
13+
self.peso=peso
1214

1315
#getter
1416
def get_name(self):
@@ -19,10 +21,17 @@ def get_name(self):
1921
def get_cognome(self):
2022
return self._cognome
2123

22-
# getter
24+
# getter
2325
def get_data_nscita(self):
2426
return self._data_nascita
2527

28+
# getter
29+
def get_sesso(self):
30+
return self.sesso
31+
32+
# getter
33+
def get_peso(self):
34+
return self.peso
2635

2736
def mangia(self):
2837
print('la persona sta mangiando')
@@ -34,11 +43,11 @@ def dorme(self):
3443
print('la persona sta dormendo')
3544

3645
def __str__(self):
37-
return str(self._nome) + ' ' + str(self._cognome) + ' ' + str(self._data_nascita)
46+
return str(self._nome) + ' ' + str(self._cognome) + ' ' + str(self._data_nascita) + ' ' + str(self.sesso) + str(self.peso)
3847

3948
def __eq__(self,other):
4049
if isinstance(other):
41-
if other._nome==self._nome and other._cognome==self._cognome and other._data_nascita==self._data_nascita:
50+
if other._nome==self._nome and other._cognome==self._cognome and other._data_nascita==self._data_nascita and other.sesso==self.sesso and other.peso==self.peso:
4251
return True
4352
return False
4453

0 commit comments

Comments
 (0)