Which of the following Python statements will not result in error? VALS = [1,…

2026

Which of the following Python statements will not result in error?

VALS = [1, "A", 2, "B", 3, "C"]

  1. A.

    print(len(VALS))

  2. B.

    print(max(VALS))

  3. C.

    print(sum(VALS))

  4. D.

    print(VALS.sort())

Attempted by 117 students.

Show answer & explanation

Correct answer: A

The list VALS contains mixed data types (integers and strings). Arithmetic operations like sum() will raise a TypeError because Python cannot add numbers to text. However, the len() function counts items regardless of type and executes successfully.

Explore the full course: Rssb Senior Computer Instructor