-5
I’m solving a simple question of calculating tax on a salary:
sal=float(input('digite o valor:'))
if sal>3000:
percent=0.25
elif sal>2000:
percent=0.20
elif sal>1000:
percent=0.10
else :
percent=0.5
imposto=sal*percent
salliquido=sal-imposto
print('salário: R$%6.2f'%sal)
print('imposto: R$%6.2f'%imposto)
print('salário liquido: R$6.2f'%salliquido)
But when I run the python returns the following error:
digite o valor:1500
salário: R$1500.00
imposto: R$150.00
Traceback (most recent call last):
TypeError: not all arguments converted during string formatting
Where am I going wrong?
At last
print
lacked the%
before the6.2
. While you’re at it, take a look at f-string, that can help you– hkotsubo