Guided project - Actual length returning 1

Screen Link:
https://app.dataquest.io/m/350/guided-project%3A-profitable-app-profiles-for-the-app-store-and-google-play-markets/5/removing-duplicate-entries-part-two

My Code:
I don’t understand why I am getting the actual length to be 1. someone please help me identify where the issue is
reviews_max = {}

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

print('Expected length:', len(android) - 1181)
print('Actual length:', len(reviews_max))

What I expected to happen:
Expected length: 9659
Actual Length: 9659

What actually happened:
Expected length: 9659
Actual Length: 1

Replace this line with the output/error

Expected length: 9659
Actual Length: 1

Hi @essyaimee7, welcome to the community!

I can’t tell because the code isn’t formatted properly in Markdown, but I suspect that your if/else statement might not be indented to be within the loop. If that’s the case, then the if/else would only run once, which would explain the length of 1. Could you check that part?

1 Like

Hi April

The indentation was the issue. I have corrected it, thanks.