Which fix removes the bug?
nums = [1, 2, 3] nums.add(4)
- Use
nums.push(4) - Use
nums.append(4) - Use
nums += 4here - Use
nums.insert(4)
Lists have no add method (that is for sets); append adds to the end.
Play Problem Solving ▸
nums = [1, 2, 3] nums.add(4)
nums.push(4)nums.append(4)nums += 4 herenums.insert(4)