0

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.

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158

1 Answers1

2

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

Got from just manually rearranging the equation for x.

NEPTTUNE
  • 58
  • 4