Epython Lab
#CODE_CHALLENGE #PYTHON_LIST #LOOPS #FUNCTIONS 1. Write a function called delete_starting_evens() that has a parameter named lst. The function should remove elements from the front of lst until the front of the list is not even. The function should then…
#SOLUTION
Many of you are tried your best solution for the challenge. We thank you so much for your contribution.
We also thanks to someone who shared the info to others.
based on the instruction this is the best solution for the challenge
#Write your function here
def delete_starting_evens(lst):
# then check the condition here
while (len(lst) > 0 and lst[0] % 2 == 0):
# then slice the list
lst = lst[1:]
return lst
# Call the function and print the result
print(delete_starting_evens([4, 8, 10, 11, 12, 15]))
print(delete_starting_evens([4, 8, 10]))
# output
[11, 12, 15]
[]
Many of you are tried your best solution for the challenge. We thank you so much for your contribution.
We also thanks to someone who shared the info to others.
based on the instruction this is the best solution for the challenge
#Write your function here
def delete_starting_evens(lst):
# then check the condition here
while (len(lst) > 0 and lst[0] % 2 == 0):
# then slice the list
lst = lst[1:]
return lst
# Call the function and print the result
print(delete_starting_evens([4, 8, 10, 11, 12, 15]))
print(delete_starting_evens([4, 8, 10]))
# output
[11, 12, 15]
[]