Module valolyticspy.services.helper.math_functions

Expand source code
def divide(a, b):
    """
    Divide two numbers and return a if the b == 0.

    Args:
        a (float): The numerator.
        b (float): The denominator.

    Returns:
        float: The result of dividing a by b or a if b == 0.
    """
    return a if b == 0 else a / b

Functions

def divide(a, b)

Divide two numbers and return a if the b == 0.

Args

a : float
The numerator.
b : float
The denominator.

Returns

float
The result of dividing a by b or a if b == 0.
Expand source code
def divide(a, b):
    """
    Divide two numbers and return a if the b == 0.

    Args:
        a (float): The numerator.
        b (float): The denominator.

    Returns:
        float: The result of dividing a by b or a if b == 0.
    """
    return a if b == 0 else a / b