input: from typing import List
  
  def factorials(numbers: List[int]) -> List[int]:
      """ Calculate the factorial for each number in the given list and return a list of the results.
      >>> factorials([1, 2, 3, 4, 5])
      [1, 2, 6, 24, 120]
      >>> factorials([0, 1])
      [1, 1]
      """
      
      def factorial(n: int) -> int:
          if n == 0:
              return 1
          else:
              return n * factorial(n - 1)
  
      return [factorial(num) for num in numbers]
output:     def factorial(n: int) -> int:
          if n == 0:
              return 1
          else:
              return n * factorial(n - 1)
  
      return [factorial(num) for num in numbers]