Hello
I trying to run this code on my Jupyter notebook but the results are different than the exercise
https://app.dataquest.io/m/312/lists-and-for-loops/10/the-average-app-rating
my code:
# Import CSV File
opened_file = open('AppleStore.csv', encoding='utf8')
from csv import reader
read_file = reader(opened_file)
apps_data = list(read_file)
rating_sum = 0
for row in apps_data[1:]:
rating = float(row[7])
rating_sum = rating_sum + rating
avg_rating = rating_sum /len(apps_data[1:])
print(avg_rating)
result: 460.3739057940809
on the Exercise, the results are 3.526955675976101
what seems to be the problem with the same code.
Rucha
#2
hey @infinetw
Welcome to the Dataquest Community!
I tried your code in console and the result was coming correct.
Could you please follow the below post and attach your Jupyter notebook for us to check why you are getting different results.
Hello
Thanks for your response I found the problem the CSV file is not the same. I have to review line by line and found some issues.