0
Data Structure
Hello please I need help really quick: I want to write a code in python as follows: A code with a function called '"Data" which acts as follows: When given a list of integers, returns 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.
5 Respuestas
0
what?
0
what is positive number? 
0
I would just run through the given list and test the data at each point with some if statements. if the item in the list >= 0 then increment the first item in the return list. For the negatives, test if the item is <0, and add it to the value of item 2 in your return list
0
def Data(z):
    x=c=0
    for i in z:
        if i%2==0:
            c+=1
        else:
            x+=i
    return([c,x])
0
Maxim,
adjust line 4 to read like: if i>=0: 
I think that should do it



