In this python program please explain every line of this code. Thank you Source Code: print("The function is f(x)= 2x+3(2)") print("Width is 0.05") lowLim=float(input("Enter Lower Limit: ")) upperLim=float(input("Enter Upper Limit: ")) iterations = (upperLim - lowLim)/0.05 i=0 finAns = 0 while(i
In this python program please explain every line of this code. Thank you
Source Code:
print("The function is f(x)= 2x+3(2)")
print("Width is 0.05")
lowLim=float(input("Enter Lower Limit: "))
upperLim=float(input("Enter Upper Limit: "))
iterations = (upperLim - lowLim)/0.05
i=0
finAns = 0
while(i<iterations):
print("_________________________________________________________________________________________________________________________________")
print("Iteration:",(i + 1))
print("Function\t\t|\tLower Limit \t|\t Upper Limit \t|\t LRAM Application (width=0.05) \t|\t Answer")
initAns=((2*lowLim)+(3*2))*0.05
print("f(x)= 2x+3(2) \t\t|\tx={:0.2f}\t\t|\tx={:0.2f}\t\t|\t f(x) = (2({:0.2f})+3(2) * 0.05\t|\t {:0.2f}".format(lowLim,lowLim+0.05,lowLim,initAns))
finAns += initAns
lowLim+=0.05
i += 1
print("_________________________________________________________________________________________________________________________________")
print("Final answer/Summation of all iterations is:",finAns)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images