input: Write a function to generate Fibonacci sequence up to a given number of terms.
  assert fibonacci_sequence(5) == [0, 1, 1, 2, 3]
  assert fibonacci_sequence(8) == [0, 1, 1, 2, 3, 5, 8, 13]
  assert fibonacci_sequence(1) == [0]
  assert fibonacci_sequence(0) == []
output: def fibonacci_sequence(n):
      if n <= 0:
          return []
      sequence = [0]
      if n > 1:
          sequence.append(1)
      while len(sequence) < n:
          sequence.append(sequence[-1] + sequence[-2])
      return sequence