Tell us what’s happening:
I thought this one would be easy, but the system says poem2 and poem 3. I do not get it,
Your code so far
def pin_extractor(poem):
secret_code = ''
lines = poem.split('\n')
for line_index, line in enumerate(lines):
words = line.split()
if len(words) > line_index:
secret_code += str(len(words[line_index]))
else:
secret_code += '0'
return secret_code
poem = """Stars and the moon
shine in the sky
white and
until the end of the night"""
poem2 = 'The grass is green\nhere and there\nhoping for rain\nbefore it turns yellow'
# User Editable Region
poem3 = 'There\nonce\nwas\na\ndragon'
poems = [poem, poem2, poem3]
print(pin_extractor(poems))
# User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3.1 Safari/605.1.15
Challenge Information:
Build a Pin Extractor - Step 16