Exam PCAP All QuestionsBrowse all questions from this exam
Question 14

Which of the following sentences are true? (Choose two.)

    Correct Answer: B, D

    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.

Discussion
palagusOptions: BD

B and D are right

TheFivePipsOptions: BD

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.

pincholinco

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.

naveenbv80Options: BD

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

666_mOptions: BD

B& D are correct.

macxszOptions: BD

B. Tuples may be stored inside lists D. Lists may be stored inside lists

DKM

lists inside tuple: t = ([1, 2], [3, 4], [5, 6]) for i in t: for j in i: print(j)

DKMOptions: BD

tuple inside list : L = [(1,2),(2,3),(4,5),(3,4),(6,7),(6,7),(3,8)]