+ 1
Is simple summation notation possible?
For example from ramge 5 to 20, n ^2=2840
2 Antworten
+ 9
print(sum(x**2 for x in range(5, 21)))
+ 1
Basicakly what kuba did.
Took numbers from 5 to 20 amd created a range object (sorta a list)
Performed an operation to each **2
returned their sum