Tell us what’s happening:
I have done everything I can think of to get my code to pass yet I keep getting the message “You should have print(words[line_index]) at the end of the loop.” Please help!
def pin_extractor(poem):
secret_code = ''
lines = poem.split('\n')
for line_index, line in enumerate(lines):
print(line_index, line)
words = line.split()
if 0 <= line_index < len(words):
print(words[line_index])
Your code so far
def pin_extractor(poem):
secret_code = ''
lines = poem.split('\n')
for line_index, line in enumerate(lines):
print(line_index, line)
words = line.split()
# User Editable Region
if 0 <= line_index < len(words):
# User Editable Region
print(words[line_index])
poem = """Stars and the moon
shine in the sky
white and bright
until the end of the night"""
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/150.0.0.0 Safari/537.36 Edg/150.0.0.0
Challenge Information:
Build a Pin Extractor - Step 8