'Google crash curse optional question solution about For loop
I decided to pass google curse for python beginners and stuck on this question. It is optional to solve but I'm angry about it as I understand that it is simple yet can't get the specific number.
def square(n):
return n*n
def sum_squares(x):
sum = 0
for n in ___:
sum += __
return __
print(sum_squares(10))
# Should be 285
the ___ fields must be changed so the output of 10 evaluate to 285. Sorry for bothering with this simple question, but I really need to understand what is the solution for this. And again, its optional question but I want to get it))
Solution 1:[1]
Here is the solution
def square(n):
return n*n
def sum_squares(x):
sum = 0
for n in range(x):
sum += square(n)
return sum
print(sum_squares(10)) # output will show : 285
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | barii |
