Boost percentage after the class test

44 Views Asked by At

The question is fairly simple and basic but I am not getting exact answer after all sort of trials.

In a classroom we can have n (let's take $n=3$) students whose knowledge is defined on discrete scale of $[p, q]$ (let's take $p=20, q=40$) now before the class test rating was 23, 34, 20 after the class test rating changes to 34, 36, 40; it is given you have to select students whose knowledge level before test was less than or equal to $a$ and after that test it turned out to be greater or equal to $b$ (let's take $a=23, b=30$), so I tried following to find percentage change:

First of all I sorted out the desired data-points that follow the condition described above and did following trials.

Desired data-points are : 23, 20 - 34, 40

Trial 1- I calculated individual percentage increase and finally took the sum of all and divided by $m=2$ where $m$ is the size of new data-points.

$((((34-23)/23)*100)+(((40-20)/20)*100))/2$

Trial 2- I calculated sum of knowledge before test and after test and then tried to find percentage increase.

$(((34+40)-(23+20))/(23+20))*100$

Note 1: There will not be any case in which knowledge will decrease i.e. case of negative percentage change .

Note 2: I have framed this as a question however I am working on pandas data-frame for data analysis where n can be large also $a$ and $b$ can choose any values from discrete range $[p, q]$ such that $a<b$ where $p$ and $q$ are positive integers such that $p<q$.