input: Write a function to calculate the factorial of a given integer and print the result. If the input is not a positive integer, return None.
  def factorial(num):
      if num < 0:
          return None
      elif num == 0:
          return 1
      else:
          return num * factorial(num - 1)
  
  n = int(input("Enter a number: "))
  result = factorial(n)
  if result is not None:
      print("Factorial of", n, "is", result)
  else:
      print("Invalid input")
  
  assert factorial(5) == 120
  assert factorial(3) == 6
  assert factorial(0) == 1
  assert factorial(-1) == None
output: def factorial(num):
      if num < 0:
          return None
      elif num == 0:
          return 1
      else:
          return num * factorial(num - 1)