I was given the following question:
Write a function last_in(x) that returns the value of x used in the previous call. The first time that the function is called, it will return None.
I did something that somewhat works, but something is missing. Here's my attempt:
def last_in(x):
def inner():
return x
return inner()
And the output of
print(last_in(3),last_in(4),last_in(5), last_in("a"),last_in("12"))
is
3 4 5 a 12
But the expected needs to be
None 3 4 5 a
What do I miss?
Thank you!