Python Forum
Data Type Issue - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: News and Discussions (https://python-forum.io/forum-31.html)
+--- Thread: Data Type Issue (/thread-19896.html)



Data Type Issue - Rahul_Kaushik - Jul-19-2019

Hi Team,

I am facing issue while executing the below code
row_1 = ['Facebook', 0.0, 'USD', 2974676, 3.5]
row_2 = ['Instagram', 0.0, 'USD', 2161558, 4.5]
row_3 = ['Clash of Clans', 0.0, 'USD', 2130805, 4.5]
ratings_1=row_1[3]
ratings_2=row_2[3]
ratings_3=row_3[3]
total=(ratings_1+ratings_2+ratings_3)
Average=(total/3)
print(Average)

 
The error says "average isn’t defined in your code, but we expected it to be float type"

Can you please help me as how to convert the output of a variable into a float datatype.
Thanks
Rahul Kaushik


RE: Data Type Issue - scidam - Jul-19-2019

The code looks executable. Did you run your code using some web-service
which produces such specific errors? Note, Python is case sensitive, may be you need to use average.


RE: Data Type Issue - Rahul_Kaushik - Jul-19-2019

Hi Scidam,

Thanks a lot , yeah I corrected the case sensitive part and it worked.

Once again Thanks.