Розкажіть, що відбувається:
URL: https://www.freecodecamp.org/ukrainian/learn/python-v9/workshop-pin-extractor/step-17
Issue:
I’m on Step 17 of the PIN Extractor workshop in the Python Certification course. The instructions ask me to update the function argument to poems, then wrap the existing function body in a for poem in poems: loop, using poem as the loop variable.
I’ve written the following code, which I believe correctly satisfies the instructions:
python
def pin_extractor(poems):
secret_code = ‘’
for poe
Ваш код на цей момент
# User Editable Region
def pin_extractor(poems):
secret_code = ''
for poem in poems:
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"""
print(pin_extractor([poem]))
# User Editable Region
Інформація про ваш браузер:
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:156.0) Gecko/20100101 Firefox/156.0
Інформація про завдання:
Створіть витягач PIN-кодів - Крок 17
Посилання на GitHub: i18n-curriculum/curriculum/challenges/ukrainian/blocks/workshop-pin-extractor/68599f0fc7479410b2269742.md at main · freeCodeCamp/i18n-curriculum · GitHub