Forums

Syntax error (noob)

Hi, I am very new to this but losing my mind. I am getting a syntax error from the bottom code line but it works perfectly in Jupyter where I have written the code:

# create an empty list to store the formatted strings
output_list = []

# iterate over the filtered dataframe and append each formatted string to the output list
for _, row in filtered_df.iterrows():
    name = row['web_name_x']
    goals = str("Goal")
    owner = row['ownername_x']
    output_list.append(f"{name} ({goals}) - {owner}")

Apologies if this is very basic. Any ideas?

Where is the syntax error?