I have a simple equation that can easily be solved by hand but I need to solve using python.
Solve for x:
x < 9
x > 4.5
x < 5.6
x > 4.8
So we can easily see x=5 is one of the acceptable solutions. But how would I go about using python to solve for x and return a single value? Thank you.
Depending on the decimal precision you need in your answer, you can increase or decrease the step size in
arangebelow. This is a pythonic way of solving the problem using list comprehension:Example:
Output:
If you only care about integer answers, use an integer step size:
Output: