"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-05 22:46:28.577192
"""

```python
from typing import Callable, Any


class FallbackExecutor:
    """
    A class that provides a fallback mechanism for executing functions.
    
    This class allows you to define primary and secondary execution methods for a given function.
    If the primary method fails (raises an exception), it tries the secondary method as a fallback.
    """

    def __init__(self, primary: Callable[..., Any], fallback: Callable[..., Any]):
        """
        Initialize FallbackExecutor with two callable functions.

        :param primary: The main function to attempt execution on
        :param fallback: The backup function to use if the primary fails
        """
        self.primary = primary
        self.fallback = fallback

    def execute(self, *args: Any, **kwargs: Any) -> Any:
        """
        Attempt to execute the primary function. If it raises an exception,
        attempt to execute the fallback function.

        :param args: Arguments to pass to the functions.
        :param kwargs: Keyword arguments to pass to the functions.
        :return: The result of the successful execution or None if both fail.
        """
        try:
            return self.primary(*args, **kwargs)
        except Exception as e:
            print(f"Primary function failed with error: {e}")
        
        try:
            return self.fallback(*args, **kwargs)
        except Exception as e:
            print(f"Fallback function also failed with error: {e}")
            return None


# Example usage
def primary_function(x):
    """Divide x by 2."""
    return x / 2

def fallback_function(x):
    """Return x if division fails (like in case of zero division)."""
    return x

fallback_executor = FallbackExecutor(primary=primary_function, fallback=fallback_function)

# Test the example usage
result1 = fallback_executor.execute(10)  # Should work and return 5.0
print(f"Result 1: {result1}")

result2 = fallback_executor.execute(0)   # Should fail in primary but succeed in fallback
print(f"Result 2: {result2}")
```