input: Write a python function to generate a pyramid pattern using asterisks.
  assert generate_pyramid(1) == "*"
  assert generate_pyramid(2) == " *\n***"
  assert generate_pyramid(3) == "  *\n ***\n*****"
  assert generate_pyramid(4) == "   *\n  ***\n *****\n*******"
  assert generate_pyramid(5) == "    *\n   ***\n  *****\n *******\n*********"
output: def generate_pyramid(n):
      result = []
      for i in range(n):
          spaces = ' ' * (n - i - 1)
          stars = '*' * (2 * i + 1)
          result.append(spaces + stars)
      return '\n'.join(result)