write a function printTable(start, nSteps, stepSize) that will print a table of x values and the corresponding values of magic(x), one x value per line. Print nSteps lines in th etable, with the x values beginning at start and increasing by stepSize for each successive line.
simply ensure that the x and corresponding function value are separated by at least one space, as in this sample output:
3.1 1.1314021114
3.15 1.4740424529
3.2 1.1631508098
3.25 1.1786549963
Please using Python to solve! Thanks!
Python Function:
def printTable(start, nSteps, stepSize):
""" Python Function that prints tabular form of values
"""
# Initializing x value
x = start
# Iterating over nSteps
for i in range(nSteps):
# Printing current iteration
values
print(str(x) + " " +
str(magic(x)))
# Incrementing x value
x = x + stepSize
Code Screenshot:
Get Answers For Free
Most questions answered within 1 hours.