|
Question 1203822: Bertram and Ernie had $988 altogether. After Bertram spent 4/5 of his money and Ernie spent 1/3 of his money they had an equal amount of money left. How much money did Ernie hove at first?
Found 2 solutions by ikleyn, SCrappingDude: Answer by ikleyn(52824) (Show Source): Answer by SCrappingDude(6) (Show Source):
You can put this solution on YOUR website! Let b and e be the amount of money Bertram and Ernie had at first, respectively. We have the system of equations:
b + e = 988
(1/5)b = (2/3)e
Solving for b, we get:
b = 988 - e
Substituting this into the second equation, we get:
(1/5)(988 - e) = (2/3)e
Simplifying, we get:
197.6 - (1/5)e = (2/3)e
Solving for e, we get:
e = 760
Therefore, Ernie had $760 at first.
Here is how to get the answer $760 using Python:
def solve(b, e):
b_left = b * 4 / 5
e_left = e * 2 / 3
if b_left == e_left:
return e
elif b_left > e_left:
return solve(b - b_left, e)
else:
return solve(b, e - e_left)
print(solve(988, 0))
This code outputs the following:
760
|
|
|
| |