Build a Pin Extractor - Step 3

Tell us what’s happening:

I am stuck on Step 3 from the Build a Pin Extractor activity. Please, could you help me?

Your code so far

def pin_extractor(poem):
    secret_code = ''
    pin_extractor (poem)
    '''Stars and the moon
    shine in the sky
    white and bright
    until the end of the night'''

# User Editable Region

global poem

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36

Challenge Information:

Build a Pin Extractor - Step 3

Hi @jlito84,

You are very close, but closely examine the steps again. You don’t need a globally referenced poem variable and you need to make sure to call the pin_extractor function with that variable. The poem variable you create should be outside that function.

Hi @marcusparsons

I don’t seem to be able to get it:

def pin_extractor(poem):

secret_code = ''

pin_extractor (poem)

‘’'Stars and the moon

shine in the sky

white and bright

until the end of the night'''

def my_function(text):

print(text)

global poem

Let’s use another example that relates to this particular objective!

If I have a function called printWhatISay and I have a parameter called mySaying that just prints out mySaying like this:

def printWhatISay(mySaying):
    print(mySaying)

And then I make a second variable that is called mySaying that is outside of the function like so:

def printWhatISay(mySaying):
    print(mySaying)
    
mySaying = '''I like to eat
eat eat
apples and banaynays'''

And then I want to call printWhatISay with that variable, I would do the following:

def printWhatISay(mySaying):
    print(mySaying)
    
mySaying = '''I like to eat
eat eat
apples and banaynays'''

printWhatISay(mySaying)

And this way it uses the outside variable of mySaying as the value for the function and then the function itself uses its own separate mySaying inside of the function.

They are two separate variables.

This exact same logic applies to this step!

I was able to crack it, thank you! :slight_smile:

1 Like

I love that! Happy Coding, my friend!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.