input: Write a Python function to generate a list of Fibonacci numbers up to the nth element.
  assert generate_fibonacci(10) == [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
  assert generate_fibonacci(5) == [0, 1, 1, 2, 3]
  assert generate_fibonacci(1) == [0]
output: def generate_fibonacci(n):
      if n <= 0:
          return []
      fibonacci_sequence = [0]
      if n > 1:
          fibonacci_sequence.append(1)
      for i in range(2, n):
          next_element = fibonacci_sequence[-1] + fibonacci_sequence[-2]
          fibonacci_sequence.append(next_element)
      return fibonacci_sequence