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

(PYTHON)Your company prints math reference tables for high school and first year

ID: 3785633 • Letter: #

Question

(PYTHON)Your company prints math reference tables for high school and first year college students. You’d like to write a flexible program that will display the results for several mathematical functions applied to a range of integers, and the results displayed in a table with a header that includes labels separated by tabs:

Num Sqr SqRt Sin Cos Tan Log Log10

=== === ==== === === === === =====

Organize your file using comments for each block of planned code

Import the math library and initialize any necessary variables

Prompt the user for the starting, ending and interval values (integers)

Print the table headers

Create a loop based on the user’s values

Print the formatted values with 2 decimal places

V

Explanation / Answer

PROGRAM CODE:

# Program to calculate math function on certain intervals
import math

#getting the start and end intervals from user
start = int(input('Enter the starting integer: '));
end = int(input('Enter the ending integer: '));
print(" Num Sqr SqRt Sin Cos Tan Log Log10");
print("=== === ==== === === === === =====");
num = 0; sqr = 0; sqrt = 0; sin = 0;
cos = 0; tan = 0; log = 10; logbaseTen = 0;
#using for loop to calculate for each interval
for i in range(start, end+1):
   num = i;
   sqr = i*i;
   sqrt = math.sqrt(i);
   sin = math.sin(i);
   cos = math.cos(i);
   tan = math.tan(i);
   log = math.log(i);
   logbaseTen = math.log10(i);
   print("%.2f" % num," ","%.2f" % sqr," ","%.2f" % sqrt," ","%.2f" % sin," ","%.2f" % cos," ","%.2f" % tan," ","%.2f" % log," ","%.2f" % logbaseTen);

OUTPUT: