Debug lambdas created in a loop that all return the same value
Interview insights are lockedSee how often this is asked and which companies asked it with Buncho Pro.A teammate builds scaling functions for several feature indexes, but every function behaves the same.
scalers = [lambda x: x * i for i in range(3)]
print([f(10) for f in scalers]) # expected [0, 10, 20]
What is printed, why, and how do you fix it (two ways)?