Removing first occurrence -Help to understand

Screen Link:
https://app.dataquest.io/m/1018/lists/16/removing-the-first-occurrence

My Code:

def remove_first(some_list,element):
    return some_list.remove(element)

suggested answers:

def remove_first(some_list, element):
    some_list.remove(element)

Why there is no need to write return in this case? or this is just a typo.
Am I missing something?

Thanks

Hello @jinyushan1990,
this is because remove does the job “in-place”. The function modifies the list that you’re passing as parameter and you don’t need to return it.

2 Likes

thanks for explaining this! :pray:

1 Like