ProgrammingEasyTCS NQT · Wipro pattern

What is printed?

What is printed?
print(list(range(10, 0, -3)))
  1. A. [10, 7, 4, 1]
  2. B. [10, 7, 4]
  3. C. []
  4. D. [10, 7, 4, 1, -2]

Correct answer: A. [10, 7, 4, 1]

range(10, 0, -3) counts down from 10 in steps of 3 and stops before reaching 0: 10, 7, 4, 1.

More Python Programming questions

Exams that ask this topic