ProgrammingVery hardJEE Main · CAT placement

What is printed?

What is printed?
print(sum(i * i for i in range(10)), sum(range(10)) ** 2 == sum(i ** 3 for i in range(10)), sum(range(10)) ** 2)
  1. A. 285 False 2025
  2. B. 2850 True 2025
  3. C. 285 True 2205
  4. D. 285 True 2025

Correct answer: D. 285 True 2025

The sum of squares 0 to 9 is 285. Nicomachus's identity says the square of a sum equals the sum of cubes, and the square of 45 is 2025.

More Python Programming questions

Exams that ask this topic