input: Write a function to calculate the Fibonacci numbers up to a given number `n`. The function should return the Fibonacci sequence as a list. If `n` is 0, it should return [0]. If `n` is 1, it should return [0, 1]. For any other value of `n`, it should return the Fibonacci sequence up to the nth term.
  
  def fibonacci_sequence(n):
      if n == 0:
          return [0]
      elif n == 1:
          return [0, 1]
      sequence = [0, 1]
      for i in range(2, n + 1):
          sequence.append(sequence[-1] + sequence[-2])
      return sequence
  
  assert fibonacci_sequence(0) == [0]
  assert fibonacci_sequence(1) == [0, 1]
  assert fibonacci_sequence(5) == [0, 1, 1, 2, 3, 5]
  assert fibonacci_sequence(10) == [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
  assert fibonacci_sequence(15) == [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610]
output: def fibonacci_sequence(n):
      if n == 0:
          return [0]
      elif n == 1:
          return [0, 1]
      sequence = [0, 1]
      for i in range(2, n + 1):
          sequence.append(sequence[-1] + sequence[-2])
      return sequence