Android and IOS apps Guided Project - Incorrect numbers of rows after removing Non-English apps

Screen Link:

My Code:
This is the code of the function to check whether the app is an English app or not.

def is_english(string):
    count = 0
    
    for character in string:

        if ord(character) > 127:
            count += 1
        
        if count > 3:
            return False
        else:
            return True

print(is_english('Docs To Go™ Free Office Suite'))
print(is_english('Instachat 😜'))
print(is_english('爱奇艺PPS -《欢乐颂2》电视剧热播'))

What I expected to happen:
After removing the non-English apps, the number of rows should be:
For android app: 9614
For ios app: 6183

What actually happened:
For android app: 9659
For ios app: 7197

Below is the code I use to generate those numbers.

android_english = []
ios_english = []

for app in android_clean:
    name = app[0]
    if is_english(name) == True:
        android_english.append(app)
        
for app in ios:
    name = app[1]
    if is_english(name) == True:
        ios_english.append(app)
        
explore_data(android_english, 0, 3, True)
print('\n')
explore_data(ios_english, 0, 3, True)
1 Like

Hi @julialee0318

At a quick glance, the problem seems to be in the function is_english()

Give special attention to the code Indentation and think again about the logic. You might be able to spot the issue. Hope this helps.

Thanks @jithins123! I’ve fixed my codes and I’ve got the right numbers now!
This is what I’ve done for anyone who would be interested.

def is_english(string):
    count = 0
    
    for character in string:

        if ord(character) > 127:
            count += 1
        
    if count > 3: #<-- this line has to be out of the for loop above
        return False
    else:
        return True

print(is_english('Docs To Go™ Free Office Suite'))
print(is_english('Instachat 😜'))
print(is_english('爱奇艺PPS -《欢乐颂2》电视剧热播'))
2 Likes

Glad you figured it out. Good job.