1
An employee of a company receives salary increase annually: It is known that:
This employee was hired in 1995, with initial salary of R $ 1.000,00;
In 1996 he received a 1.5% increase over his initial salary;
From 1997 (inclusive), wage increases always correspond to twice the percentage of the previous year.
Make a program that determines the employee’s current salary.
After completing this, change the program allowing the user to enter the employee’s initial salary.
My code:
salario = int(input('Digite o salário do funcionário: '))
ano = 1996
porcentagem = 1.5/100
salario_1 = salario
while ano <= 2020:
salario = salario + (porcentagem * salario_1)
ano += 1
porcentagem += porcentagem
print(salario)
My real doubt is how to limit the print of an integer (Ex.1234567, and only appear --> 123), because the output of my code comes out a little strange sometimes. With the salary being 1000, the output is: 503317465.0 (and I doubt that’s even the right result).
Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful to you. You can also vote on any question or answer you find useful on the entire site
– Maniero