Build a Pin Extractor - Step 16

Tell us what’s happening:

I don’t know why I’m stuck here. Can you guys help me ?

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"""


# User Editable Region

poem2 = """The grass is greeen
here and there
hoping for rain
before it turns yellow"""

poem3 = """There 
once 
was
a
dragon"""

(pin_extractor(poem))
(pin_extractor(poem2))
(pin_extractor(poem3))

# 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/26.2 Safari/605.1.15

Challenge Information:

Build a Pin Extractor - Step 16

did you do this? make sure you do this too

and for now, comment out the print with the call to pin_extractor .

try writing the poems exactly as given in the instructions all on one line