Skip to content

Instantly share code, notes, and snippets.

@TheLoneNut
Created March 24, 2021 23:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheLoneNut/497d9a175b41c34c586b9f489073b990 to your computer and use it in GitHub Desktop.
Save TheLoneNut/497d9a175b41c34c586b9f489073b990 to your computer and use it in GitHub Desktop.
Just an example software bug
def append_y_words(y_words, base_list=[]):
'''
Purpose: Return a list of words from the base_list (if any) followed by
words starting with 'y' from the words list.
'''
y_words = [word for word in y_words if word.startswith('y')]
base_list += y_words
return base_list
print append_y_words(["yoyo", "player"]) # should print ['yoyo']
print append_y_words(["yours", "puppet"], ["truly"]) # should print ['truly', 'yours']
print append_y_words(["yesterday"]) # should print ['yesterday'] , but does something else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment