Practice mode Python

Which of these built-in Python types is immutable?

Correct answer A. tuple

Explanation

Once a tuple is created its items cannot be added, removed or reassigned, which makes tuples immutable. Lists, dictionaries and sets are mutable containers with methods such as append, update and add. frozenset is the immutable counterpart of set, and str and int are immutable too.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.