Build a Pin Extractor - Step 16

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

please do all the things written in the instructions

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

Read the instructions and implement exactly what it says.

If it’s not in the instructions, don’t do it. Don’t try to guess at what you are to do. Just follow the instructions exactly as written.

You may need to reset this step first.

Ok, just found out what the meaning was of commenting out…

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.