0
The replace() method is a method of the str class, correct?
Follows a code that 'rotates' perfectly where the object is an integer (or at least in my interpretation). Or in the case of interpolation this changes?
Follows:
def moeda(valor, moeda = 'R$'):
return f'{moeda}{valor:.2f}'.replace('.', ',')
velocidade = float(input('Qual é a velocidade do carro? (KM) '))
if velocidade > 80:
print('VELOCIDADE PERMITIDA ULTRAPASSADA!')
print('\033[1;31mMULTADO!\033[m')
multa = (velocidade - 80) * 6
multa = moeda(multa)
print(f'Você foi multado em {multa}')
else:
pass
PS. The currency() function transforms an integer number into a currency format, replacing integer points with commas.
is a fstring, I think ta normal, because the number is formatted inside the string, and then the string is changed by replace. I think looking at the point between the string and replace, this object orientation indicates that replace will act on the output of the freight method
– Elton Nunes