A. Lists may not be stored inside tuples
This statement is incorrect. In Python, lists can be stored inside tuples. Tuples are immutable, but they can contain mutable elements like lists.
B. Tuples may be stored inside lists
This statement is correct. In Python, you can have a list that contains elements of various types, including tuples.
C. Tuples may not be stored inside tuples
This statement is incorrect. Tuples can indeed be stored inside other tuples. Tuples in Python can contain elements of various types, and this includes other tuples.
D. Lists may be stored inside lists
This statement is correct. In Python, you can have a list that contains elements of various types, including other lists.
So, the correct answers are B and D.
they are all true nothing stops you from storing anything inside a touple you shouldn't store a list because that defeats the point of tuple since the tuple element (the list) can now be modified but I suppose it will need to remain a list.
list_inside_tuple = ([1, 2], [3, 4], [5, 6])
print(list_inside_tuple)
tuple_inside_list = [(1,2),(2,3),(4,5),(3,4),(6,7),(6,7),(3,8)]
print(tuple_inside_list)
my answer is B and D
tuple inside list :
L = [(1,2),(2,3),(4,5),(3,4),(6,7),(6,7),(3,8)]
upvoted 1 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
TheFivePips
11 months, 4 weeks agopincholinco
1 year agonaveenbv80
1 year, 12 months agopalagus
2 years, 6 months ago666_m
2 years, 6 months agomacxsz
2 years, 7 months agoDKM
3 years agoDKM
3 years ago