input: Write a function to print the following pattern: a triangle of asterisks (*) that increases in size up to 5 rows and then decreases back to 1 row. If the input is invalid (not a number or a number less than 1), the function should print an error message "Invalid input".
  assert print_pattern(5)
  assert print_pattern(-1) == "Invalid input"
  assert print_pattern("a") == "Invalid input"
  assert print_pattern(0) == "Invalid input"
output: def print_pattern(n):
      if not isinstance(n, int) or n < 1:
          print("Invalid input")
          return
      for i in range(1, n + 1):
          print('*' * i)
      for i in range(n - 1, 0, -1):
          print('*' * i)