Build a Pin Extractor - Step 14

Tell us what’s happening:

i dont seem to understand this question, i am lost and confused.

Your code so far

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

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

print(pin_extractor(poem))

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/153.0.0.0 Safari/537.36

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

Hi @pztk.org,

Try adding some print functions inside your loop to help you understand what this code is doing:

print(line_index, line)
print(words)
print(len(words[line_index]))

Happy coding

i can do that xD haha thanks im gonna give it a try

so when i print(line_index) it gives me the number of the lines. when i add print(line_index, line) it gives me the actual lines of the poem. what is confusing me is that enumerate lines in line. yet the “line_index” is the one that is the one that is doing the numbering for the lines. so if i would translate the code into a sentence it would be:
create a line_index from lines and enumerate them and add the lines to the variable “line” placing them next to the numbers?

enumerate gives for each item in lines both the index, which goes in line_index and the line itself that goes in line