All challenges
Multiple ChoiceIntermediate 30s

Mutable Default Argument

def f(x=[]) is a bug because the default list:
Options
  1. 1The mutable default cannot be changed afterwards
  2. 2A mutable default argument raises a TypeError
  3. 3Is created once and shared across calls
  4. 4The mutable default is copied fresh each call

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle