Your question is Python Average Session Duration. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
EA SPORTS FC gameplay telemetry contains one record for each completed user session. Write a function that calculates the average session duration across all provided sessions.
Each session is represented by a dictionary containing a user_id, start, and end. The start and end values are integer timestamps measured in minutes from a common reference point. The average should include every session, regardless of whether multiple sessions belong to the same user.
Return 0.0 when the input contains no sessions.
Implement average_session_duration(sessions).
sessions, a list of dictionaries. Each dictionary has:
user_id: a stringstart: an integer start timestampend: an integer end timestampend - start for all sessions.def average_session_duration(sessions):