0

What does g(xs[:-2]) mean?

def f(xs):
    def g(ys):
        return ys[::-1]
    
    return [x-2+(2*7/4) for x in g(xs[:-2])]
Olvin Roght
  • 7,677
  • 2
  • 16
  • 35

1 Answers1

0

Here's how it works, it passes xs variable (a string/list) and slices it to remove the last two elements/characters (-2 means to slice from the end of string/list) to function g()

Wasif
  • 14,755
  • 3
  • 14
  • 34