So I some how managed to get the right code for the output, but im still puzzuling what the code ‘lst = lst[1:]’ is doing for the function? So for example if I write ‘lst = lst[0:]’ the output returns the original list which was put in the function , and when I write ‘lst = lst[2:]’ the function returns an empty list. Does anyone have an indea what ‘lst = lst[1:0]’ is specifically doing to the function? Any help would be greatly aprreciated.
The code for the function is here below.
def delete_starting_evens(lst):
for i in lst:
if i % 2 == 1:
break
lst = lst[1:]
return lst
print(delete_starting_evens([4, 8, 10, 11, 12, 15]))
Output: [11, 12, 15]