Hi,
I'm building out a billing system for my SaaS platform and I need a simple pricing engine to sit at the heart of it.
Before we can charge a customer anything, the system needs to validate the inputs and calculate the correct final price. Here's what I need:
The function should accept a product price and a discount percentage. Before doing any calculation it needs to reject bad data gracefully — non-numeric inputs, prices at or below zero, and discounts outside the 0-100 range should all return clear, specific error messages rather than crashing.
If everything checks out, I need the final price after the discount applied, ready to be passed on to the payment processor.
Clean, reliable, and predictable — this is going in a production system so it needs to handle whatever gets thrown at it.
Hi,
Just run this through a full set of test scenarios and I'm satisfied it does exactly what the billing system needs.
The validation layer is solid — non-numeric inputs, zero or negative prices, and out-of-range discounts all return clear, specific error messages rather than crashing. That's exactly what I need when this sits upstream of a payment processor.
The calculation is clean and correct. Tested it across multiple price and discount combinations and the maths is right every time.
One observation for future development — you'll want to add some print statements or logging around the valid calculation outputs when this goes into a wider system, so the results surface properly downstream. But for the core function brief, this is signed off.
Good work. Looking forward to seeing what you build next.
Hi,
I'm building a simple AI agent and before it does anything else it needs to make a basic decision — should it attempt a task or not?
Here's the situation. My agent receives tasks from users but I need it to screen each task before attempting it. I need a simple eligibility checker built in Python that assesses whether the agent should proceed based on the following:
task_complexity— a number representing how complex the task is on a scale of 1-10is_online— whether the agent currently has an internet connectionhas_api_key— whether a valid API key is availablehas_memory— whether the agent has access to its memory/contexthas_fallback— whether a fallback model is available if the primary fails
The rules are:
- If
task_complexityhas no value, printCannot assess task - Complexity of 1-3 — print
Proceedonly if online - Complexity of 4-7 — print
Proceedonly if online and API key available - Complexity of 8-10 — print
Proceedonly if online, API key, memory and fallback are all available - Otherwise print
Do not proceed
This is exactly the kind of decision logic that sits inside real AI agents. Build it, and you've built something genuinely relevant to where this whole plan is heading.
Hi,
Just had a chance to run this through its paces and I'm happy to confirm it does exactly what I needed.
Tested it across all scenarios — low complexity tasks, mid-range, and the high complexity ones that need the full stack of resources available. It makes the right call every time. The Do not proceed fallback is exactly the safety net I was looking for.
Clean, readable code too — I can see what it's doing without needing it explained to me, which matters when my team need to maintain it.
Consider this signed off. Looking forward to seeing what you build next.