Map problem on Intermediate Python | Sololearn: Learn to code for FREE!

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)

1/27/2022 3:48:27 AM

Quality Crew

2 Answers

New Answer

+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])