Given that my_val is a list of float values, which of the following is an example of a built-in function?

Prepare for the Computer Science (CS) III Exam. Study with multiple choice questions, detailed explanations, and comprehensive resources. Boost your confidence and ace the exam!

The choice of len(my_val) as the correct answer is valid as it utilizes a built-in Python function that returns the number of items in an object, in this case, the list stored in my_val. The len() function is widely used to determine the size of various data structures, including lists, strings, and dictionaries, making it a fundamental tool in Python programming.

In contrast, the other examples do not represent built-in functions. The average() function is not built into Python directly; instead, it is available through libraries such as statistics, indicating that it isn't a built-in function accessible without an import. The methods my_val.title() and my_val.capitalize() are string methods and are called on string objects, not lists. Since my_val is a list of floats, calling these methods would result in an error, as they are not applicable to list types.

Therefore, len(my_val) stands out as the only option that is indeed a built-in function applicable to the data type of my_val.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy