A question I got on my last interview:
Design a function f, such that: f(f(n)) == -n Where n<
Design a function f, such that:
f
f(f(n)) == -n
Where n<
n<
Nobody ever said f(x) had to be the same type.
def f(x): if type(x) == list: return -x[0] return [x] f(2) => [2] f(f(2)) => -2