Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 4. Write Python script that will print out integers 1 through 10, and th

ID: 3663761 • Letter: P

Question

Problem 4. Write Python script that will print out integers 1 through 10, and their square roots and cube roots. Use the list: range (1,11,1) to define the numbers. Use math.pow(x,n) function.To calculate square roots and cube rootes, define function power(def power (x) etc.) that calculates these values. Then, print them out in the form x,sqrt(x),cuberoot(x), one below the other (print command should be outside of the power function). Utilize the for command  [e.g., for i in range (1,11,1): ] and at each value of i call the function power(x) to complete the calculation and return the result, and then print the result out on the screen.

Please help, I keep getting float errors and can't get math.pow to work.

Explanation / Answer

variable usedin loop condition is the number i, which you use to count the integers from 1 to 10. First you initialise this number to 1. In the condition, you check whether i is less than or equal to 10, and if this is true you execute the loop body. Then, at the end of the loop body, you update i by incrementing it by 1.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote