How does this print?

Hi, the code below prints to the screen, i am unsure why? Even if i remove the print function it will still print out
3 rows? I was wondering why this is?

android_english = []


for app in android_clean:
    name = app[0]
    if is_english(name):
        android_english.append(app)
        
explore_data(android_english, 0, 4, True)
# print('\n')   > remove and it still prints

output:

[‘Photo Editor & Candy Camera & Grid & ScrapBook’, ‘ART_AND_DESIGN’, ‘4.1’, ‘159’, ‘19M’, ‘10,000+’, ‘Free’, ‘0’, ‘Everyone’, ‘Art & Design’, ‘January 7, 2018’, ‘1.0.0’, ‘4.0.3 and up’]

[‘U Launcher Lite – FREE Live Cool Themes, Hide Apps’, ‘ART_AND_DESIGN’, ‘4.7’, ‘87510’, ‘8.7M’, ‘5,000,000+’, ‘Free’, ‘0’, ‘Everyone’, ‘Art & Design’, ‘August 1, 2018’, ‘1.2.4’, ‘4.0.3 and up’]

[‘Sketch - Draw & Paint’, ‘ART_AND_DESIGN’, ‘4.5’, ‘215644’, ‘25M’, ‘50,000,000+’, ‘Free’, ‘0’, ‘Teen’, ‘Art & Design’, ‘June 8, 2018’, ‘Varies with device’, ‘4.2 and up’]

[‘Pixel Draw - Number Art Coloring Book’, ‘ART_AND_DESIGN’, ‘4.3’, ‘967’, ‘2.8M’, ‘100,000+’, ‘Free’, ‘0’, ‘Everyone’, ‘Art & Design;Creativity’, ‘June 20, 2018’, ‘1.1’, ‘4.4 and up’]

Number of rows: 9614
Number of columns: 13

here is the solution: https://github.com/dataquestio/solutions/blob/master/Mission350Solutions.ipynb

Thanks

1 Like

Hi @Frankie,

Maybe the explore_data function is the culprit?

It has its own prints :

def explore_data(dataset, start, end, rows_and_columns=False):
    dataset_slice = dataset[start:end]    
    for row in dataset_slice:
        print(row)
        print('\n') # adds a new (empty) line between rows
        
    if rows_and_columns:
        print('Number of rows:', len(dataset))
        print('Number of columns:', len(dataset[0]))

3 Likes

Thanks Wan,

Cant believe I missed that!

Yeah I see how that works. Thank you.

1 Like

Sorry for the late reply. I’ve been MIA for awhile.

No worries. It happens to all of us haha.

1 Like