Screen out non-english name app

Hi,can you see my code below. the number of row in android is different from the answers. I got 10795 rows instead of 9614 rows.
which part has the problems?

def is_english(string):
non_ascii=0
for character in string:
if ord(character)>127:
non_ascii +=1
if non_ascii >3:
return False
else:

       return True 

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

android_english=
ios_english=

for row in android:
name=row[0]
if is_english(name):
android_english.append(row)

for row in ios:
name=row[1]
if is_english(name):
ios_english.append(row)

print(‘android_english’)
explore_data(android_english,0,3,True)

print(‘ios_english’)
explore_data(ios_english,0,3,True)

Well, your code looks fine. The problem could be in the indentation, but I cannot figure it out because the code is poorly formatted. Can you format it properly?

You can use ``` before and after the code.

For the ios part below, a think you should assign row[2] to name, not row[1]:

for row in ios:
    name=row[1]
    if is_english(name):
        ios_english.append(row)

Hello @candiceliu93,

The error is here, you are taking the loop over the original dataset andriod.

To screen out the non-English name apps, you should have already cleaned the original dataset by removing duplicates apps and then you store the new dataset into a new list of lists called andriod_clean (according to the instructions on the guided project).

After doing this, you the iterate over the new dataset andriod_clean to get the same number of rows as the one in the answer

for app in android_clean:
    name = app[0]
    if is_english(name):
        android_english.append(app)

Also, kindly take note to @otavios.s’s advice when making your next post to make it easy for others to read and identify errors in the code.

Let me know if this helps.

1 Like

Good point @doyinsolamiolaoye. I thought about this too but assumed the second dataset was named after the first one. I would approach it if there was no indentation problem.

1 Like

Thank you @doyinsolaniolaoye!! yes, it worked after i changed it…

1 Like

@candiceliu93, You are welcome. Kindly mark the reply as the solution then.