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.
1
Expert's answer
2016-09-19T14:54:03-0400
def manipulate_data(data): pos, neg = 0, 0 for x in data: if x >= 0: pos += 1 else: neg += x return [pos, neg]
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment