Tell us what’s happening:
- The else clause should contain secret_code += ‘0’.
- Your code raised an error before any tests could run. Please fix it and try again.
// tests completed
Your code so far
# User Editable Region
def pin_extractor(poem):
secret_code = ""
lines = poem.split("\n")
for line_index, line in enumerate(lines):
words = line.split()
if line_index < len(words):
# Append the length of the word at position line_index
secret_code += str(len(words[line_index]))
else:
# If not enough words, append '0'
secret_code += '0'
return secret_code
# User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36 Edg/144.0.0.0
Challenge Information:
Build a Pin Extractor - Step 15