# Analyzing Clicks A Python Function for Extracting Weekly Stats users_data = [ {'day': 0, 'clicks': 100}, {'day': 1, 'clicks': 10}, {'day': 2, 'clicks': 150}, {'day': 3, 'clicks': 1000}, {'day': 4, 'clicks': 100}, {'day': 5, 'clicks': 190}, {'day': 6, 'clicks': 150}, {'day': 7, 'clicks': 1000} ] def get_stats(day): # -1 to start from day 0 because day in date is 1 return users_data[day - 1: day + 7] print(get_stats(1))