Number or not?
In Listing 1, we have four versions of a Python function split_values_per_type that receives a list of values and splits them into two lists: one with the numbers and another with the non-numbers. The function should return the two lists as the tuple (numbers, non_numbers).
For this question, a value is numeric exactly when type(value) in (int, float) is True. Therefore, integers and floating-point values are numeric, while strings and Boolean values are non-numeric.
Which implementation of split_values_per_type in Listing 1 correctly splits every input value and returns (numbers, non_numbers)?
TipHint
split_values_per_type(values)must return its two result lists as a tuple. For example, input[2, "X"]should produce([2], ["X"]); empty input should produce([], []).type(value)returns the value’s type:type(2)isint,type(2.5)isfloat, andtype(True)isbool.values.append(item)adds one item to the end of that list and returnsNone. For example, appending"B"to["A"]changes it to["A", "B"].