What is the result of `len([1, 2, 3])` in Python?

Study for the WGU C173 Scripting and Programming Test. Dive into coding challenges and multiple-choice questions with expert explanations. Prepare thoroughly and excel!

The function len() in Python is used to determine the number of items in an object, such as a list, tuple, string, or dictionary. When you apply len() to a list like [1, 2, 3], it counts the number of elements present in that list. In this case, the list contains three elements: 1, 2, and 3. Therefore, when you call len([1, 2, 3]), the result will be 3. This reflects the fact that there are three items in the provided list.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy