Question: please use python 1. Use functions from the Python math module Write a program (MathFunctions.py) that prints a table of values for the absolute value
please use python
1. Use functions from the Python math module Write a program (MathFunctions.py) that prints a table of values for the absolute value of x and for 2* values from -10 to 10. Use a for loop to print the table. Per iteration one line of the table will be printed. You do not need to define your own function here. Use the pow function and the fabs function as described in the math module of Python. You need to import the math module (see slide 6) before you can use the functions. For the header line of the table use the following print statement (one time, before the loop): print ("x" + "\t" + "abs(x)" + "\t" + "pow(2,x)"). "\t" can be used to print the tab-stops (the big blank spaces, between the words or numbers). The output of your program will look like this: x fabs (x) pow(2,x) -10 10.0 0.0009765625 9.0 0.001953125 8.0 0.00390625 7.0 0.0078125 6.0 0.015625 5.0 0.03125 4321 IIIO 123456789 4.0 0.0625 3.0 0.125 2.0 0.25 1.0 0.5 0.0 1.0 1.0 2.0 2.0 4.0 3.0 8.0 4.0 16.0 5.0 32.0 6.0 64.0 7.0 128.0 8.0 256.0 9.0 512.0 10 10.0 1024.0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
