0
I’m not able to overwrite the self.Valorbase on the Low Income class. Could someone help me?
te = 0.25588
tusd = 0.25971
icms = 0
desc_te = te - (te * 0.10 / 100)
desc_tusd = tusd - (tusd * 0.30 / 100)
class Cliente:
def __init__(self, vb):
self.ValorBase = vb * (te + tusd)
self.NomeClasse = self.__class__.__name__
def valorIcms(self):
return self.ValorBase * icms
print('{:^40}'.format(self.NomeClasse))
print(vb)
print(f'{self.ValorBase:.2f}')
print(f'{self.valorIcms():.2f}')
class BaixaRenda(Cliente):
def __init__(self, vb):
Cliente.__init__(self, vb)
if vb <= 220:
self.ValorBase = vb * (desc_te + desc_tusd)
def valorIcms(self):
return self.ValorBase * icms
#Programa Principal
kwh = int(input('Valor Gasto: '))
b = BaixaRenda(kwh)
yes, it overwrites, but to see the new value has to do a new print, and I wanted the new value to appear in the print that is in the client class
– FreddySp
It worked. Thank you so much for your help.
– FreddySp