input: def fibonacci_series(n: int) -> list:
      """Generate a Fibonacci series up to a given number n and return the series as a list.
      >>> fibonacci_series(5)
      [0, 1, 1, 2, 3]
      >>> fibonacci_series(0)
      [0]
      >>> fibonacci_series(1)
      [0, 1]
      >>> fibonacci_series(10)
      [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
      """
      if n < 0:
          return []
      a, b = 0, 1
      series = [a]
      while b <= n:
          series.append(b)
          a, b = b, a + b
      return series
output:     if n < 0:
          return []
      a, b = 0, 1
      series = [a]
      while b <= n:
          series.append(b)
          a, b = b, a + b
      return series