type(remainder) = tuple
Can someone explain why the type of this variable is tuple? What we want when using 'remainder is to have space for more input. But doesn't that contradict the tuple definiton?
Thank you for reaching out!
Please refer to the definition of a tuple in the Python documentation. Hope this clears any confusion!
When the calc_mean function is called, it may receive a variable number of arguments, and all but the first will be put in a tuple. So the size of the tuple depends on the number of arguments, which may vary. But for each function call, the arguments don't change between the call and the resolution of the function. This way, the function may be used with a variable number of arguments, but once the arguments are given they don't need to be mutable.