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