How to represent a series as a list?

66 views Asked by At

Is it possible to represent a series so that it is reusable, i.e. so that it can be stored in a variable?

Something like:

from collections import Counter

def myFunction(arr: List[int]) -> int:
    c = Counter(arr)
    s = k for k in c if c[k] == k

This doesn't work, throws error:

    s = k for k in c if c[k] == k
          ^^^
SyntaxError: invalid syntax
0

There are 0 answers