6. Program to input salary of an employee and display the salary that the person will receive for each
of the next 5 years if he gets an increment of 10% every year.
python (in loop)
unnecessary answer will be report.
Answers
Answered by
5
def increment(salary):
salaries = []
new_salary = salary
for _ in range(5):
new_salary *= 1.1
salaries.append(round(new_salary, 2))
return "\n".join([f"Year {idx + 1}: {salary}" for idx, salary in enumerate(salaries)])
print(increment((salary := float(input("salary: ")))))
Answered by
4
Answer:
def increment(salary):
salaries = []
new_salary = salary
for _ in range(5):
new_salary *= 1.1
salaries.append(round(new_salary, 2))
return "\n".join([f"Year {idx + 1}: {salary}" for idx, salary in enumerate(salaries)])
print(increment((salary := float(input("salary: ")))))
Similar questions