# Answer to Question #62060 in Python for Stephen Oyaro

Question #62060

Write a function called manipulate_data which will act as follows:

When given a list of integers, return a list, where the first element is the count of positives numbers and the second element is the sum of negative numbers.

NB: Treat 0 as positive.

When given a list of integers, return a list, where the first element is the count of positives numbers and the second element is the sum of negative numbers.

NB: Treat 0 as positive.

Expert's answer

def manipulate_data(values):

a = len(filter(lambda x : x >= 0, values))

b = sum(filter(lambda x : x < 0 , values))

return [a, b]

a = len(filter(lambda x : x >= 0, values))

b = sum(filter(lambda x : x < 0 , values))

return [a, b]

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment