Write a while loop that calculates the sum of the cubes of numbers starting from 1 to 40 (inclusive). That is, the loop prints the foloowing value 1 + 23 +33 + ... +403. Make sure to define any variables you may need.
s = 0 n = 1 while n <= 40: s += n**3 n += 1 print(s)
Need a fast expert's response?
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!