My code is matching the solution but I get an error?

Screen Link: <Learn data science with Python and R projects! Capture|690x206
creen below–>

My Code:

fb_rating_data = row_1[0], row_1[3], row_1[4]
insta_rating_data = row_2[0], row_2[3], row_2[4]
pandora_rating_data = row_5[0], row_5[3], row_5[4]
#2
avg_rating = (fb_rating_data[2] + insta_rating_data[2] + pandora_rating_data[2]) / 3
print(avg_rating)

fb_rating_data is a tuple, but we expected it to be a list.```

What am I missing here?
1 Like

Hi @Paul_Walker ,

Welcome to the Community!

Your code is technically correct and, indeed, it gives the correct value of avg_rating. However, pay attention that in the instructions, you were explicitly asked to create the variables fb_rating_data, insta_rating_data, and pandora_rating_data as lists, and in your current version of code, they are tuples (to check it, run type() on any of them). The warning that you received says exactly this, for the first variable the code encountered (fb_rating_data).

Even if you got the correct result, for the answer-checking purposes, you have to make each of those variables a list instead of a tuple. To fix it, just surround the expression for each of them into squared braces. For example, for the first variable, the code will be:

fb_rating_data = [row_1[0], row_1[3], row_1[4]]

and analogically for the others.

2 Likes

Thanks a lot for your answer!

It probably would have taken me some time to figure this detail out. :smiley:

2 Likes

thanks so much for this answer. Am getting more confidence and enjoying the thread. will revise and go over the concepts again.thanks.
do we have any topics on c programming as well here?

1 Like

Hi @ibdikoedu89,

That’s great, happy to hear that my answer was helpful!

As for C, no, there are no such topics in our Community. At Dataquest, people learn Python and R programming languages, a query language SQL, the command line, Tableau, Power BI, Excel, and Azure. So the threads here are all about these tools, at least for now.