input: Write a python function to generate an array where each element is double the previous one.
  assert generate_double_array(1) == [1]
  assert generate_double_array(5) == [1, 2, 4, 8, 16]
  assert generate_double_array(0) == []
  assert generate_double_array(3) == [1, 2, 4]
output: def generate_double_array(n):
      if n == 0:
          return []
      result = [1]
      for _ in range(1, n):
          result.append(result[-1] * 2)
      return result