ProgrammingModerateTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
print(len([x for x in range(10) if x % 3 == 0]), sum(range(0, 10, 3)))
  1. A. 4 18
  2. B. 3 18
  3. C. 4 15
  4. D. 3 9

Correct answer: A. 4 18

The multiples of 3 below 10 are 0, 3, 6 and 9, so there are four. Their sum is 18.

More Python Programming questions

Exams that ask this topic