Skip to content
RED SAGSkills
hard20 pts · first answer countshash-mappythondebugging

Deleting from a dict while looping

This Python loop raises an error. What is it, and what is the fix?

for user, last_seen in sessions.items():
    if last_seen < cutoff:
        del sessions[user]
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions