5 ms·
That’s what walrus is for: future = lambda age: ( print('Your age is:', age), older := age + 5, print('Your age in the future:', ol
by mixmastamyk 1y ago
That’s what walrus is for:
future = lambda age: (
print('Your age is:', age),
older := age + 5,
print('Your age in the future:', older),
older,
)[-1]
print(future(20))
# out
Your age is: 20
Your age in the future: 25
25