Created
March 24, 2021 23:10
-
-
Save TheLoneNut/497d9a175b41c34c586b9f489073b990 to your computer and use it in GitHub Desktop.
Just an example software bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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