Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRinze Winters
4,932 PointsBug report
He!
I believe there is a bug in the verification of this assignment. The assignment passes with the attached code. However this code would not only pick words from words[] starting with a 'y'.
For that reason there should be a word in words[] with an 'y' in it but doesnt start with it. Such as "today".
Same goes for comprehension see second code.
words = [
'yellow',
'red',
'yesterday',
'tomorrow',
'zucchini',
'eggplant',
'year',
'month',
'yell',
'yonder',
]
def check(word):
return 'y' in word
y_words = list(filter(check, words))
words = [
'yellow',
'red',
'yesterday',
'tomorrow',
'zucchini',
'eggplant',
'year',
'month',
'yell',
'yonder',
]
y_words = [word for word in words if 'y' in word]
3 Answers
natalia iaroslavskaia
7,293 Points'''y_words = [word for word in words if word[0] == "y"]'''
natalia iaroslavskaia
7,293 Pointsy_words = [word for word in words if word[0] =="y"]
natalia iaroslavskaia
7,293 PointsThe letter 'y' has to be on the first place.
gustavoalvarado
Python Development Techdegree Graduate 11,933 PointsHi! Here is another option to solve the Challenge. Have a nice day!
words = [
'yellow',
'red',
'yesterday',
'tomorrow',
'maybe',
'zucchini',
'eggplant',
'year',
'month',
'yell',
'yonder',
'today',
]
y_words = [words for words in words if words.startswith('y')]
nakalkucing
12,964 Pointsnakalkucing
12,964 PointsYou're right Rinze Winters. This does appear to be a bug. Seems kinda funny that it hasn't been fixed yet. :)