Correct result but the program would not accept

I wasn’t able to code the solution the program wanted. I used this and the program did display the correct result but the program would not accept:

df['get_last_name'] = df.name.apply(lambda x: x.split(' ')[-1])

Result:

id	name	hourly_wage	hours_worked	get_last_name
0	10310	Lauren Durham	19	43	Durham
1	18656	Grace Sellers	17	40	Sellers

This is the result the program wanted, why break it up?

get_last_name = lambda x: x.split()[-1]
df['last_name'] = df.name.apply(get_last_name)

If you were coding for a personal project or work purposes, your solution would be perfectly fine!

However, the code lessons tend to go step by step, making the test cases behind it validate each step you take, not the final outcome.

I also got stuck in this lesson for longer that I anticipated, and at the end, the problem was the same you faced.