Question: Fred has 40 baseball cards. Keith bought 22 of Fred's  baseball cards. How many baseball cards does Fred have now ?

Solution program:
from sympy import symbols, solve
x = symbols("x")
answer = solve(40-22-x)
print(answer)

Answer: 18