SyntaxFix
Write A Post
Hire A Developer
Questions
You can also use map:
a = [1, 1, 1, 1, 1] b = 1 list(map(lambda x: x + b, a))
It gives:
[2, 2, 2, 2, 2]