Piecewise price, solve break-even against a flat 100, plot.
Goal
Print the break-even units and write report.txt.
from pathlib import Path
import numpy as np
import sympy as sp
x = sp.symbols('x', real=True)
fee = sp.Piecewise((10.5 * x, x <= 10), (105 + 9 * (x - 10), True))
print('f(8)', fee.subs(x, 8), 'f(12)', fee.subs(x, 12))
sol = sp.solve(sp.Eq(10.5 * x, 100), x)
print('break-even vs 100', sol)
f = sp.lambdify(x, fee, 'numpy')
xs = np.linspace(0, 20, 80)
plt.plot(xs, f(xs))
plt.axhline(100, color='gray')
plt.title('kiosk fee')
plt.show()
Path('report.txt').write_text(f'break-even={sol}\n', encoding='utf-8')
print(Path('report.txt').read_text(encoding='utf-8'))