Python Programming - Variables - Discussion
Discussion Forum : Variables - General Questions (Q.No. 28)
28.
Which of the following is NOT a valid way to declare a tuple?
Answer: Option
Explanation:
my_tuple = tuple(1, 2, 3)
is not a valid way to declare a tuple in Python.
Instead, you can use my_tuple = 1, 2, 3
or my_tuple = (1, 2, 3)
to create a tuple directly, or use the tuple()
function to convert another iterable (like a list) into a tuple.
For example: my_tuple = tuple([1, 2, 3])
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers