Reputation: 3
Basically, I need to solve the number of classes to be attended to reach a certain percentage. It leaves me with this formula:
required_percentage=(attended+x/conducted+x)*100
.
Here, I require "x" as it is the number of classes to be attended.
I tried using sympy
module:
import sympy
from sympy.abc import x
sympy.solve(f"(({attended}+x)/({conducted}+x))*100/{required}","x")
But this just constantly gave this answer: [-4]
.
Upon manual calculation it solves to 30
.
Upvotes: 0
Views: 49
Reputation: 68
x=((required_percentage * conducted)-(100*attended))/(100-required_percentage)
Got from just manually rearranging the equation for x.
Upvotes: 2