Given a variable n refers to a positive int value, use two additional variables , k and total to write a for loop to compute the sum of the cubes of the first n counting numbers, and store this value in total. Thus your code should put 1*1*1 + 2*2*2 + 3*3*3 +... + n*n*n into total. Use no variables other than n, k, and total.
1
Expert's answer
2018-09-25T12:09:07-0400
n = int(input('input n -> ')) total = 0 for k in range(n+1): total += k*k*k print (total)
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment