Build a Pin Extractor - Step 3

Tell us what’s happening:

I am stuck with step 3 of Pin Extractor. Firstly, I don’t know why poem should be declared global while being a parameter of the function.

Your code so far


# User Editable Region

def pin_extractor(poem):
    secret_code = ''
poem = '''Stars and the moon\nshine in the sky\nwhite and bright\nuntil the end of the night'''
print(pin_extractor(poem))

# 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/140.0.0.0 Safari/537.36

Challenge Information:

Build a Pin Extractor - Step 3

https://www.freecodecamp.org/learn/full-stack-developer/workshop-pin-extractor/step-3

the global poem variable is there so you can call the function with a poem, otherwise you don’t have anything to test the function with

it can’t be a local variable inside the function as that would make the function be not reusable

Thanks, and the code that doesn’t pass? What is the issue with that?

are you asked to use print?

1 Like

No, and I don’t know why I saw that as print. Thank you.