Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Python by (55.6k points)

A. list

B. set

C. tuple

D. dict

1 Answer

0 votes
by (119k points)

The answer is option C (Tuple). The tuple is immutable i.e we can change the elements, delete the existing elements, and cannot add new elements. Here is an example of what will happen if you try to reassign an element in tuple:

a = (1, 2, 3, 4)

a[0] = 1

On running the above code, you will get an error message “TypeError: 'tuple' object does not support item assignment”.

The datatypes like int, float, bool, str, tuple, and Unicode are immutable. Datatypes like list, set, dict are mutable.

I recommend checking out this Python Tutorial by Intellipaat to learn more about Datatypes in Python.

Also, watch this video on Python data types:

Interested to learn more about Python? Come & join our Python course

Related questions

–1 vote
3 answers
0 votes
3 answers
0 votes
2 answers
0 votes
2 answers
asked Feb 9, 2021 in Python by Rekha (2.2k points)

1.2k questions

2.7k answers

501 comments

693 users

Browse Categories

...