SZanlongo
7/28/2016 - 2:39 PM

Element-wise division of a tuple by a scalar

Element-wise division of a tuple by a scalar

def divide_tuple_scalar(a, b):
    """
    Element-wise division of tuple a by scalar b
    :param a: tuple
        n-tuple
    :param b: scalar
    :return: tuple
    """
    return tuple(i / b for i in a)