Write a function pop_four_elements() that removes the last four elements of a list parameter.
This is what I have so far:
def pop_four_elements(values_list):
return values_list[:-4]
values_list = input().split()
pop_four_elements(values_list)
print(values_list)
But when I run it, it doesn’t remove the last 4 items of the list. Instead it gives back all the values.
New contributor
Ma. Adela Esperanza Agbanlog is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.