input: Write a function that generates the Fibonacci sequence up to the nth number and returns it as a list of integers. The function should initialize an empty list of size n, fill in the first two terms explicitly (0 and 1), and then use a loop to fill in the remaining terms by summing the previous two terms.
  
  def fibonacci_sequence(n): 
      # Creating list of length n 
      fib_list  = [0]*n 
        
      # first and second terms 
      fib_list[0] = 0
      fib_list[1] = 1
        
      # Application of the recursive algorithm 
      for i in range(2, n): 
          fib_list[i] = fib_list[i-1] + fib_list[i-2] 
        
      return fib_list
  
  assert fibonacci_sequence(5) == [0, 1, 1, 2, 3]
  assert fibonacci_sequence(10) == [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
  assert fibonacci_sequence(1) == [0]
  assert fibonacci_sequence(2) == [0, 1]
output: def fibonacci_sequence(n): 
      fib_list  = [0]*n 
      if n > 0:
          fib_list[0] = 0
      if n > 1:
          fib_list[1] = 1
      for i in range(2, n): 
          fib_list[i] = fib_list[i-1] + fib_list[i-2] 
      return fib_list