Which THREE of the following are immutable data types in Python?
Strings cannot be altered after creation; any operation such as concatenation or upper() returns a new str object rather than modifying the original. This immutability is what allows strings to be used as dictionary keys and satisfies the question's requirement for immutable types.
Why this answer
In Python, str (A) is immutable because string objects cannot be modified in place—operations like concatenation or replace() return a new string rather than altering the original. int (B) is immutable since integer objects have a fixed value once created, and arithmetic operations produce new int objects instead of changing existing ones. float (C) is likewise immutable, as floating-point values cannot be changed after creation and any arithmetic yields a new float object. By contrast, list (D) is mutable because elements can be added, removed, or reassigned in place, and dict (E) is mutable because key-value pairs can be inserted, updated, or deleted after the dictionary is created.
Exam trap
Python Institute often tests the misconception that all numeric types are mutable or that strings can be changed in place, leading candidates to incorrectly select list or dict as immutable.