0
Map problem on Intermediate Python
This code is used to calculate the sum between salaries and bonuses. I get the correct amounts, however, I donât know how to make it so it prints out a list at the end instead of each individual elements amounts. salaries = [2000, 1800, 3100, 4400, 1500] bonus = int(input()) for i in salaries: print(i + bonus)
2 Answers
+ 5
You can declare an empty list and add each updated price to that list using append() method.
Or you can use map() instead of for loop.
+ 2
print(*[s+bonus for s in salaries])