def scalar_addition(seq, scalar, mod = 0):
    """ Returns the result of adding scalar (a number) to all elements in seq.
        If mod is not 0, then all addition occurs modulo mod. 
    
        Note: this function is an "analogue" of scalar multiplication - an 
        operation where every element in a sequence is multiplied by a scalar.
        We can also use this function to perform "scalar subtraction" - the
        subtraction of a scalar from all elements in a sequence. 
    """
    if mod == 0:
        return [(index + scalar) for index in seq];
    else:
        return [((index + scalar) % mod) for index in seq];