Question: 7-3: Sum of Cubes (Python) Write a program that finds the sum of the cubes of the first n natural numbers. You should have 2

7-3: Sum of Cubes (Python)

Write a program that finds the sum of the cubes of the first n natural numbers. You should have 2 different programs,

one written with a for loop and one written with a while loop.

Test code:

print(sum_of_cubes(10))

print(sum_of_cubes(20))

print(sum_of_cubes(100))

Sample run:

3025

44100

25502500

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!