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])
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)