subject

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 .

The following didn't work.

n = 0
k = 0
total = 0

for n in range(1, k+1):
total += n**3

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 15:30
Write a program in plp assembly that counts up by one starting from zero (or one) inside a loop and writes this value to the leds every time the value is increased. the memory address of the leds is 0xf0200000. the table below shows the meaning and an example usage of the instructions covered in the video, plp instructions for project 1. instruction example usage meaning load immediate li $t0, 8 register $t0 is set to the value, 8. store word sw $t2, 0($t1) the value in register $t1 is used as the memory address. the value in register $t2 is copied into this memory address. add addiu $t4, $t3, 29 register $t4 is assigned the sum of 29 and the value in register $t3. jump j your_label_name the program jumps to the line following the label, "your_label_name: ". label your label name: defines a label called "your_label_name: " that can be jumped to
Answers: 2
question
Computers and Technology, 24.06.2019 01:30
Hazel has just finished adding pictures to her holiday newsletter. she decides to crop an image. what is cropping an image?
Answers: 1
question
Computers and Technology, 24.06.2019 14:00
Fast answer i need for apex ! smartphones should be banned from the classroom in public schools so that students cannot cheat on test so easily? which is an example of a counter argument to the thesis above? a.the classroom is a place for learning not for making phone calls b. smartphones are useful learning tools in the modern classroom c.banning smartphones will not students pay attention to teachers any better d. banning smartphones would decreased incidents of theft
Answers: 2
question
Computers and Technology, 24.06.2019 17:30
What is the next step if your volume does not work on computer
Answers: 2
You know the right answer?
Given a variable n refers to a positive int value, use two additional variables , k and total to wri...
Questions
question
Mathematics, 11.09.2019 17:30
question
Arts, 11.09.2019 17:30
question
Biology, 11.09.2019 17:30