π️ How to Quickly Calculate Discounted Price with Function Calculator
Have you ever stood in a store thinking:
“This item is 30% off… but how much will it actually cost?”
Instead of pulling out a normal calculator and pressing buttons again and again, Function Calculator lets you create your own function for this. Once you make it, you can reuse it anytime with just one line.
✨ The Function
Here’s a simple function for discount calculation:
def discount(price, percent) = price * (100 - percent) / 100;
Copy above code in the Factory page and press run button to implement code and press save button to save the function for later use.
Here
price = original price
percent = discount percentage
π‘ Example Usage
Imagine a jacket that costs 50 dollars and it’s on 30% sale.
Just type:
discount(50, 30)
➡️ The result will be:
35
So you’ll pay 35 dollars instead of 50.
π― Why It’s Useful
No need to re-think formulas every time.
Works for any discount rate, not just 30%.
You can even combine it with tax calculation if you want to know the final checkout price.
π With Function Calculator, shopping math becomes quick and fun.
Next time you see a sale sign, just type one line and get the answer instantly.
Comments
Post a Comment