Blue Week Special Offer | Brighten your week!
days
hours
minutes
seconds

Normalize_value function error

Could someone help with it? I checked my code many times, I dont know which part has a problem. The error shows '`SyntaxError: invalid syntax``

Screen Link:https://app.dataquest.io/m/210/guided-project%3A-winning-jeopardy/3/normalizing-columns

My Code:

def normalize_value(string):
    value=re.sub('[^\w\s]','',string)
    try:
        value=int(value)
    except Exception:
        value=0
    return value

normalize_value($200)

What I expected to happen:
I expect to remove $

What actually happened:

SyntaxError: invalid syntax

Hi @candiceliu93,

Everything is fine with your function. You just forgot the quote marks:

normalize_value('$200')

got it! thank you! !

1 Like