Which of the following sentences are true? (Choose two.)
Which of the following sentences are true? (Choose two.)
Tuples may be stored inside lists, as lists in Python can contain elements of various types, including tuples. Additionally, lists may be stored inside lists, as lists can contain any type of element including other lists. These properties allow both nested lists and nested tuples, making statements B and D correct.
B and D are right
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
B& D are correct.
B. Tuples may be stored inside lists D. Lists may be stored inside lists
lists inside tuple: t = ([1, 2], [3, 4], [5, 6]) for i in t: for j in i: print(j)
tuple inside list : L = [(1,2),(2,3),(4,5),(3,4),(6,7),(6,7),(3,8)]