Is my code valid?

Hi, I wrote this and got the same example.
Is this a valid solution? If not why so?

#Write your function here
def over_nine_thousand(lst):
n = 0
while n < 9000:
n += lst[0]
lst = lst[1:]
return n

#Uncomment the line below when your function is done
print(over_nine_thousand([8000, 900, 120, 5000]))