input: Write a function to print an inverted triangle pattern.
  assert inverted_triangle(5) == "*****\n ***\n  *"
  assert inverted_triangle(3) == "***\n *"
  assert inverted_triangle(1) == "*"
output: def inverted_triangle(n):
      pattern = []
      for i in range(n):
          spaces = ' ' * i
          stars = '*' * (2 * (n - i) - 1)
          pattern.append(spaces + stars)
      return '\n'.join(pattern)