15,997,597 members
1.00/5 (1 vote)
See more:
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.

What I have tried:

YESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.......................SSS
Posted
Updated 14-Sep-16 7:30am
[no name] 14-Sep-16 8:24am
"YESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.......................SSS" is not compilable code in any programming language that I am familiar with so I am pretty sure that is not what you have tried.
Karthik_Mahalingam 14-Sep-16 13:20pm
:)
DEVIN_DEVIN 14-Sep-16 8:30am
am sorry,am new to this site,and i read that hurriedly as "HAVE YOU TRIED",here is my code,please check it for me;

def manipulate_data(data):
if isinstance(data, (list, tuple, set)):

return [len([n for n in data if isinstance(n, int) and n > 0]), sum(n for n in data if isinstance(n, int) and n < 0)]
Karthik_Mahalingam 14-Sep-16 13:21pm
Always use  Reply   button to post comments/query to the concerned user, so that the user gets notified and respond to your text.

## Solution 1

Carefully.

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!

DEVIN_DEVIN 14-Sep-16 7:57am
HERE IS MY CODE I NEED TO CHECK IF IT IS RIGHT

def manipulate_data(data):
if isinstance(data, (list, tuple, set)):

return [len([n for n in data if isinstance(n, int) and n > 0]), sum(n for n in data if isinstance(n, int) and n < 0)]
OriginalGriff 14-Sep-16 7:59am
Then run it and supply it with a list of numbers...see what it returns. Do the numbers look right? If so, try with different numbers. If you test enough cases, you should get an idea of if it works or not...
And DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalization if you want to be taken seriously.

## Solution 2

We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
So, Reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we may help.

## Solution 3

try this

C#
```public void SomeFunction()
{
List<int> lst = new List<int> ();
var data = manipulate_data(lst);
}

public  List<int>  manipulate_data (List<int> lstInput)
{
int positiveCount =0;
int negativeSum = 0;
foreach (var item in lstInput)
{
if (item > 0)
positiveCount++;
else if (item < 0)
{
negativeSum += item;
}
}
List<int> lstOutput = new List<int>();
return lstOutput;

}```