input: Write a function to generate a list using a while loop in Python that appends the current number to the list.
  assert generate_list()([]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
  assert generate_list()([]) == [0, 1, 2]
  assert generate_list()([]) == [0, 1, 2, 3, 4]
  assert generate_list()([]) == [0, 1, 2, 3, 4, 5, 6, 7, 8]
  assert generate_list()([]) == [0, 1]
output: def generate_list():
      def inner(lst):
          i = 0
          while i < 10:
              lst.append(i)
              i += 1
          return lst
      return inner