Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

how do i make the code correct O of 3 points Question 1 Unlimited tries Given that n refers to a positive integer, use a

how do i make the code correct

image text in transcribed

O of 3 points Question 1 Unlimited tries Given that n refers to a positive integer, use a while loop to compute the sum of the cubes of the first n counting numbers, and assign this value to total. In other words, total should be assigned: 1 * 1 * 1 + 2 * 2 * 2 + ... ni nin Use no variables other than n, k, and total. 1 total=0 2 k=1 3 - while kun: total+=k***k 5 k+=1 n 4 HA 1 Logic errors. Review the test case table. Remarks and hints When executed, your code went into an infinite loop. Carefully check the condition in any loop you have written and carefully consider the body of the loop-- be sure that it will eventually make the loop condition false

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DNA Databases

Authors: Stefan Kiesbye

1st Edition

0737758910, 978-0737758917

More Books

Students also viewed these Databases questions

Question

2. Show the trainees how to do it without saying anything.

Answered: 1 week ago