Intellipaat Back

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

A) [1, 2, 3]

B) (1, 2, 3)

C) {1, 2, 3}

D) {}

2 Answers

0 votes
by (3.9k points)

The correct answer to the question “Which of the following is a Python Tuple” is option (B). (1, 2, 3). Because in Python, Tuple is represented in round brackets. So, all the other options are incorrect. So, if you wish to train in Python and enhance your job prospects, then check out the Python certification course from Intellipaat. Also, watch our YouTube video on How to Learn Python.

0 votes
by (1.9k points)

The Correct Answer is B) (1, 2, 3): a Python tuple.

Explanation

There are various types of data structures in Python and they are defined with specific symbols:

A) [1, 2, 3]: it is a list. Lists are mutable, that means the content can be changed after definition, for instance adding/removing elements and defined with square brackets.

B) (1, 2, 3): This is a tuple. Tuples are much like lists, but are immutable-that is, once they're created, you can't change their contents. They're defined with parentheses and so are quite different from lists.

C) {1, 2, 3}: This is a set. Sets are collections of unique elements and are defined using curly braces. Sets also happen to be mutable, just like lists, but cannot contain duplicate values.

D) {}: It would be an empty dictionary. In Python, dictionary data types are collections of a pair of keys values while also defined using the following symbols: {}. To have a set that is considered as empty, set() will be used instead.

Related questions

0 votes
3 answers
0 votes
2 answers
0 votes
1 answer
–1 vote
3 answers

1.2k questions

2.7k answers

501 comments

693 users

Browse Categories

...