How do I solve linear equation?

45 Views Asked by At

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.

1

There are 1 best solutions below

0
NEPTTUNE On BEST ANSWER

x=((required_percentage * conducted)-(100*attended))/(100-required_percentage)

Got from just manually rearranging the equation for x.