List Comprehension Vs. For Loop
#3 · 3 of 20Free sampleQuestion
List Comprehension Vs. For Loop
Compute the sum of the squares of 1..1000 using a list comprehension. Then print 'LCSUM:' plus the sum. (The sum of squares of 1..1000 is 333833500.)
solution.py
Loading editor…
Sign up to unlock
The reference answer is one click away.
Free account unlocks the reference answer, the explanation, and the GPT tutor on every exercise in the library.
- Reference answer + explanation revealed after each attempt
- GPT tutor for every problem
- Progress saved on the platform
- 1,598 graded exercises
- Free forever — no credit card
Sign up to unlock
The reference answer is one click away.
Free account unlocks the reference answer, the explanation, and the GPT tutor on every exercise in the library.
- Reference answer + explanation revealed after each attempt
- GPT tutor for every problem
- Progress saved on the platform
- 1,598 graded exercises
- Free forever — no credit card
