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)
- A. 285 False 2025
- B. 2850 True 2025
- C. 285 True 2205
- 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
- What is printed? python print(f'{3.14159:.2}', f'{"abc":.2}', f'{0.5:.0%}')
- What is printed? python from fractions import Fraction print(Fraction(1, 2) + 0.5 == 1, Fraction(1, 3) 3 == 1, type(Fraction(1, 2) +…
- What is printed? python print(max(-3, 2, key=abs), min(-3, 2, key=abs), sorted([-3, 2, -2], key=abs), sorted([-3, 2, -2], key=lambda v…
- What is printed? python print(1 - 0.9 == 0.1, round(1 - 0.9, 1) == 0.1, 1 - 0.9 > 0.09, 1 - 0.9)
- What is printed? python print(len('a1b22c333'.split('2')), ''.join(c for c in 'a1b22c333' if c.isdigit()), len('a1b22c333'))
- What is printed? python print(0.1 + 0.1 + 0.1 == 0.3, 0.1 3, 0.3 / 0.1, int(0.3 / 0.1))