QuestionQ8

VerifiedData Collections – Tuples, Dictionaries, Lists, and Strings

Which line should be inserted into the code snippet below so that it produces the expected output?

Expected output:

Question Image

Code:

Question Image

Explanation

Python’s list.sort() method sorts a list in place. After it runs, print(list) displays the elements in ascending order as [1, 2, 4, 7].

Community Discussion

No comments yet. Be the first to start the discussion!