Answer the question
In order to leave comments, you need to log in
How to implement the logic for calculating the cost depending on the number of units of goods?
The task is to calculate the purchase price depending on the number of units of goods. Are there ready-made libraries that would provide an opportunity to describe the calculation of the total cost from the number of specified units of goods? For example, in the same python code:
If the user specified up to 10 units, then the unit cost does not change;
If the user specified from 10 to 20 units - then the unit cost is -3%;
If the user has indicated more than 20 units - then the cost of a unit of goods is -5%
Thank you.
Answer the question
In order to leave comments, you need to log in
If the scheme is always "from ... to ... - discount ... percent", then you can simply make a rules constructor.
The constructor script will show the simplest form in which the user enters three numbers into the text fields, after which this rule is saved in a special file.
Well, the main program will take the rules from the same file.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question