Build a Pin Extractor - Step 14

Tell us what’s happening:

Really getting stuck here, cannot move on, what should I do?

Your code so far

# User Editable Region

def pin_extractor(poem):
    secret_code = ''
    lines = poem.split('\n')
    for line_index, line in enumerate(lines):
# User Editable Region
        words = line.split()
        secret_code += str(len(words[line_index]))
# User Editable Region
        if len(words) > line_index:
            pass
    return secret_code

poem = """Stars and the moon
shine in the sky
white and bright
until the end of the night"""

print(pin_extractor(poem))

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.6478.251 Safari/537.36 UOS Professional

Challenge Information:

Build a Pin Extractor - Step 14

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/workshop-pin-extractor/6855918e87c33c6979d21d3f.md at main · freeCodeCamp/freeCodeCamp · GitHub

where are you doing this part?

Put the line secret_code += str(len(words[line_index])) in an if statement that checks that there are enough words in the words list.

note also the failed test

Inside the if statement you should have secret_code += str(len(words[line_index])).

Hi @Gary.hu1025,

Put the line secret_code += str(len(words[line_index])) in an if statement that checks that there are enough words in the words list.

Is the line of code you were asked to write inside the if statement?

Happy coding

really no idea what to do next

yeah, no idea for the solution

Thx for u guys’ reminders, I got it!!