input: Write a function to print a pattern of asterisks in ascending and descending order based on the given instruction. The function should take an integer `n` as input and print a pattern with `n` rows of ascending asterisks followed by `n` rows of descending asterisks.
  assert print_pattern(3) 
  # expected output:
  # *
  # **
  # ***
  # **
  # *
  assert print_pattern(5) 
  # expected output:
  # *
  # **
  # ***
  # ****
  # *****
  # ****
  # ***
  # **
  # *
output: def print_pattern(n):
      for i in range(1, n + 1):
          print('*' * i)
      for i in range(n - 1, 0, -1):
          print('*' * i)