I'm getting a syntax error :)

Screen Link:

My Code:

opened_file = open('AppleStore.csv')
from csv import reader
read_file = reader(opened_file)
apps_data = list(read_file)

non_free_non_sn_games = []
for row in apps_data[1:]:
    rating = float(row[7])
    genre = row[11]
    price = float(row[4]
     if not (genre == 'Social Networking' or genre == 'Games') and not price == 0:

avg_non_free_non_sn_games = sum(non_free_non_sn_games) / len(non_free_non_sn_games)```

What I expected to happen:

I expected that I don’t have any syntax error

What actually happened:

Traceback (most recent call last):
  File "/tmp/ccb3379c2b6724c3eee9a42e83277b1dfb53a26e.py", line 86, in run_code_string
    exec(code, variables)
  File "<string>", line 13
    if not (genre == 'Social Networking' or genre == 'Games') and not price == 0:
SyntaxError: invalid syntax

You are missing a closing parenthesis above. That’s the cause of the error.

1 Like

oh! thank you that’s one error, and also I had a problem in an indentation in line 13, but now it’s fixed. thank you for your reply.

1 Like