[Solved] Data structures homework in Python


This should work well, just needed to correct some things.

def manipulate_data(data):
    if isinstance(data, list):
        return [sum(1 for n in data if isinstance(n, int) and n >= 0), sum(n for n in data if isinstance(n, int) and n < 0)]
    else:
        return 'Only lists allowed'

solved Data structures homework in Python