QUESTION 2 OF 10

How do instance variables differ from class variables?

Reveal the answer and explore the explanation.

02
EasyCore

How do instance variables differ from class variables?

Answer
Answer

Instance attributes normally belong to individual objects; class attributes are shared through the class unless shadowed.

Practical example

Keep a fitted scaler's learned mean on the instance rather than a mutable class attribute.

Reference: Further reading ↗

Last 30 min revisionHigh-yield interview Q&As