SyntaxFix
Write A Post
Hire A Developer
Questions
You can use built-in map function:
map
result = map(lambda x: x * P, S)
or list comprehensions that is a bit more pythonic:
result = [x * P for x in S]