def safe_divide(num, denom):
    """Divides the two numbers, avoiding ZeroDivisionError.

    Args:
        num: numerator
        denom: demoninator

    Returns:
        the quotient, or 0 if the demoninator is 0
    """
    try:
        return num / denom
    except ZeroDivisionError:
        return 0