I have a question on the “if, or” conditional statement for exercise 313-6 (Data Analyst, Python).
The instructions that were provided are to:
Complete the code in the editor to compute the average rating of the apps whose genre is either “Social Networking” or “Games.”
Initially, I’ve written my code as:
if genre == ‘Social Networking’ or ‘Games’:
This gave me a figure of 3.5 (for example). I realised that this was wrong, and the answer is infact
if genre == ‘Social Networking’ or genre == ‘Games’:
which gave me a rating of 3.6. In this case, I missed out the second part of the “genre ==”. However, I’d like to know what is being calculated in my first code where the rating is 3.5? It seems like removing the “or genre == ‘Games’” would give me 2.98 rating (solely for Social Networking). So, what is python calculating when I missed out the “genre ==” for the 2nd part of my 1st code?