Hi all,
I am going deeper into the App Store and Google Play project and I am trying to get a sample of apps that:
- Have a rating bigger than 4: first IF
- Are in the ‘Photo & Video’ or ‘Games’ categories: second if
- Have more than 100000 ratings
However, when I execute the code I found out that when it gets to the last IF it stops the loop as soon as it cannot find an app with more than 100000 ratings. I want the code to continue iterating over everything and show me all the apps with more than 100000 ratings.
When I tried to put all the IFs together with AND functions, I also found out that not all the IF conditions would work, often finding ratings lower than 4.
What am I missing?
My Code:
sample_for_devs_Apple = []
well_rated_sample_Apple = []
for apps in final_dataset_Apple[1:]:
ratingApple = float(apps[7])
if ratingApple > 4.0:
well_rated_sample_Apple.append(apps)
for appsApple in well_rated_sample_Apple:
user_rating_count_Apple = float(appsApple[5])
genre_Apple = appsApple[11]
if genre_Apple == ('Photo & Video' or 'Games'):
sample_for_devs_Apple.append(appsApple)
final_sample_with_installs_for_devs_Apple = []
for apps in sample_for_devs_Apple:
names_Apple_sample = apps[1]
ratings_Apple_sample = apps[7]
rating_count_Apple_sample = float(apps[5])
if rating_count_Apple_sample > 100000:
final_sample_with_installs_for_devs_Apple.append(apps)
print(final_sample_with_installs_for_devs_Apple)
print(len(final_sample_with_installs_for_devs_Apple))