Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created January 31, 2019 15:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save codecademydev/49aff0034e3bd4bcc785c0e53ee6a979 to your computer and use it in GitHub Desktop.
Save codecademydev/49aff0034e3bd4bcc785c0e53ee6a979 to your computer and use it in GitHub Desktop.
Codecademy export
#Write your function here
def delete_starting_evens(lst):
#for num in lst:
#if lst[0] % 2 == 0:
#lst = lst[1:]
#return lst
for num in lst:
if lst[0] % 2 == 0:
lst.pop(0)
return lst
#Uncomment the lines below when your function is done
print(delete_starting_evens([4, 8, 10, 11, 12, 15]))
print(delete_starting_evens([4, 8, 10]))
@Gowtham-Sridhar
Copy link

def delete_starting_evens(lst): empty = [] for element in lst: if element % 2 != 0: index = lst.index(element) return lst[index:] return empty

How about with this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment