Raghaw Panpaliya
Raghaw Panpaliya

Reputation: 3

How do I solve linear equation?

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

Answers (1)

NEPTTUNE
NEPTTUNE

Reputation: 68

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

Got from just manually rearranging the equation for x.

Upvotes: 2

Related Questions