def pin_extractor(poems):
for poem in poems:
poems = \[poem, poem2, poem3\]
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'
poem3 = 'There\\nonce\\nwas\\na\\ndragon'
#print(pin_extractor(poems))
can you please share a link to the step?
I’ve edited your post to improve the readability of the code. When you enter a code block into a forum post, please precede it with three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add the backticks.
See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
