"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-08 17:49:57.428582
"""

```python
from typing import Callable, Any, Union


class FallbackExecutor:
    """
    A class for executing functions with fallbacks in case of errors.

    Attributes:
        primary_executor (Callable): The main function to execute.
        secondary_executors (List[Callable]): List of backup functions to try if the primary fails.
        exception_types (Union[type, Tuple[type]]): Exception types to catch during execution.

    Methods:
        run: Executes the primary executor and falls back to other executors on error.
    """

    def __init__(self,
                 primary_executor: Callable,
                 secondary_executors: Union[Callable, list],
                 exception_types: Union[type, tuple] = Exception):
        self.primary_executor = primary_executor
        if isinstance(secondary_executors, list):
            self.secondary_executors = secondary_executors
        else:
            self.secondary_executors = [secondary_executors]
        self.exception_types = (exception_types,) if not isinstance(exception_types, tuple) else exception_types

    def run(self, *args, **kwargs) -> Any:
        """
        Executes the primary executor and falls back to other executors on error.

        Args:
            *args: Positional arguments to pass to the functions.
            **kwargs: Keyword arguments to pass to the functions.

        Returns:
            The return value of the first function that executes successfully or None if all fail.
        """
        for func in [self.primary_executor] + self.secondary_executors:
            try:
                result = func(*args, **kwargs)
                return result
            except self.exception_types as e:
                print(f"An error occurred: {e}")
        return None


# Example usage

def primary_operation(x):
    """Divide x by 2"""
    return x / 2

def secondary_operation(x):
    """Multiply x by 3 if the previous operation failed (simulating a different strategy)"""
    return x * 3

def invalid_operation(x):
    """Simulate an error with division by zero"""
    return x / 0


fallback_executor = FallbackExecutor(primary_operation, [secondary_operation], ZeroDivisionError)

# Test cases
result1 = fallback_executor.run(4)
print(result1)  # Should print 2.0

result2 = fallback_executor.run(0)
print(result2)  # Should print 0 since primary operation would be 0/0 which raises an error and secondary handles it by returning 0*3=0

try:
    result3 = fallback_executor.run(1, invalid_operation)
except Exception as e:
    print(f"Caught exception: {e}")  # This should catch the ZeroDivisionError and use the fallback
```