Screen Link:
https://app.dataquest.io/c/57/m/313/conditional-statements/8/comparison-operators
My Code:
opened_file = open('AppleStore.csv')
from csv import reader
read_file = reader(opened_file)
apps_data = list(read_file)
apps_over_nine = []
apps_under_nine = []
for row in apps_data[1:]:
price = float(row[4])
ratings = float(row[7]
if price > 9.0:
apps_over_nine.append(ratings)
if price < 9.0:
apps_under_nine.append(ratings)
avg_rating = sum(apps_over_nine) / len(apps_over_nine)
n_apps_more_9 = len(apps_over_nine)
n_apps_less_9 = len(apps_under_nine)
What I expected to happen:
It should process the data.
What actually happened:
Traceback (most recent call last):
File "/tmp/30a83603b54a4f2e4f7ff4dae606c8d067004ecb.py", line 86, in run_code_string
exec(code, variables)
File "<string>", line 11
if price > 9.0:
^
SyntaxError: invalid syntax
Not sure why itβs saying there is a String in the if statement.