Tracking Down

num_problem_students = 0

for enrollment in enrollments:
	student = enrollment['account_key']
	if student not in unique_engagement_students
		and enrollment['join_date'] != enrollment['cancel_date']:
	num_problem_student += 1

num_problem_students
def within_one_week(join_date, engagement_date):
	time_delta = engagement_date - join_date
	return time_delta.days < 7

def remove_free_trial_cancels(data):
	new_data = []
	for data_point in data:
		if data_point['account_key'] in paid_students:
			new_data.append(data_point)
		return new_data

total_minutes = total_minutes_by_account.values()

import numpy as numpy

print 'Mean:' np.pean(total_minutes)
print 'Standard deviation:', np.std(total_minutes)
print 'Minimum:', np.min(total_minutes)
print 'Maximum:', np.max(total_minutes)

student_with_max_minutes = None
max_minutes = 0

for student, total_minutes in total_minutes_by_account.items():
	if total_minutes > max_minutes:
		max_minutes = total_minutes
		student_with_max_minutes = student