1. Suppose we want to solve the inequality . Let the solution to this inequality
ID: 3792997 • Letter: 1
Question
1. Suppose we want to solve the inequality . Let the solution to this inequality be . By computer, we want to find the value of . We know will be larger than 2. So, we just check many points starting from 2, to see which is the first one to make the inequality hold. We just set that number as the value of . The following is the C code to do so. Please convert the C code to Python code to solve the same problem. double x; double num; int stop=1; while (stop==1) { num=x+exp(x); if(num>20) { stop=0; print(“The solution to the inequality is x> “, x); } x=x+0.001; }
Explanation / Answer
import math
x=input('enter x : ')
num=0
stop=1
while (stop==1):
num = x+math.exp(x)
if(num>20):
stop=0
print('The solution to the inequality is x>', x);
x=x+0.001
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.