input: Write a python function to print a pattern of stars using nested loops.
  assert pattern_of_stars(3) == '* \n* * \n* * * \n'
  assert pattern_of_stars(5) == '* \n* * \n* * * \n* * * * \n* * * * * \n'
  assert pattern_of_stars(1) == '* \n'
output: def pattern_of_stars(n):
      result = ''
      for i in range(1, n + 1):
          result += '* ' * i + '\n'
      return result