CodeRigor

WEEKLY ENGINEERING PRACTICE

Two names, one list

A small reasoning exercise. Follow the behavior, choose an explanation and use the feedback to decide what to practice next.

Trace the behavior

What does the final line print? Follow the objects rather than the variable names.

Python
first = [10, 20]
second = first
second.append(30)
print(len(first), len(second))

Choose your explanation