You actually get a message like this?
The first arrow shows the indentation for the for poem in poems: loop. All statements indented at that level are inside that loop.
The second arrow shows the indentation for the for line_index, line in enumerate(lines): loop. All statements indented at that level are inside the second for loop.
Now look at your placement of return secret_codes. What level of indentation does it align with?
yes , but not in the console.
Is it 5262 or 5202 ?
Can you think of why it would only return 1 result and not 3?
Did you review the indentation shown by @dhess ?
Aligned with the append command. I have no indentation issue as of now.
So you want your program to append secret_code to secret_codes and then return secret_codes?
This is why you only get 1 output, but you should have one PIN for each poem.
3 inputs means you should have 3 outputs
Yes, @Tsirha; you do have an indentation issue. You are returning the secret_codes array inside a loop. When you use return inside a loop, it breaks the loop.
Is that 3 return messages. I am lost. Please explain.
Please direct me where the return should go. I have tried alternatives. At the very done causes indentation error. After append, does not pass and console indicates [3020]
Your function cannot have 3 return messages. return ends the function.
Your for loop needs to process each poem and add it (append it) to secret_codes.
When the loop is finished, then you can return secret_codes as it will have all 3 outputs.
If return is in the loop, it’s going to exit the function after the first iteration and not process any further inputs.
When I return after the print command, the indentation issue occurs.
That’s because return would be just by itself, outside the function.
What would you be returning from, if you are not within the function?
It’s now inside where it was during the last step. The pint function # is removed and the 3 poems are the arguments. Still no pass. [2302] in console message : function should return
Is return inside or outside of the for loop?
Hello.
Secret_code is not a list
You not need yo append it
Comment ir remove the line before return secret_code
secret_code is being appended to secret_codes, which is a list.
That line of code is correct and should not be removed!
I had the same problem at first. To fix the error you were getting, just un-indent the return secret_codes line so that it falls under the first for loop
