Why convert string to float instead of int for the column of review

Screen Link:

Profitable App Profiles for the App Store and Google Play Markets

Original Code:

for app in android:
    name = app[0]
    n_reviews = float(app[3])
    if name in reviews_max and reviews_max[name] < n_reviews:
        reviews_max[name] = n_reviews
    elif name not in reviews_max:
        reviews_max[name] = n_reviews

I’m just wondering why we need to convert string to float instead of int since review is integer. I have tried as follows, and there was no error raised.

n_reviews = int(app[3])



No, you are correct. Since these are the number of reviews and not the ratings, int is perfectly fine and acceptable. It’s also a better option than float.

It’s unclear as to why they used float here, but int is fine too.

1 Like

Hi, thank you for the confirmation!

1 Like