• 1000 и float не для str
class Conta(Cliente):
def __init__(self, nome, idade, cpf, agencia, conta, saldo):
super().__init__(nome, idade, cpf)
self._agencia = agencia
self._conta = conta
self.saldo = saldo
@property
def saldo(self):
print('teste getter')
return self._saldo
@saldo.setter
def saldo(self, value):
print('test setter')
if not isinstance(value, (int, float)):
ValueError('value NEED to be a number!')
self._saldo = value
cliente = Conta('leonardo', 1231,123123,1232,123123,saldo = 'it is supposed to print ValueError')
#output
test setter