Designing algorithms
When designing algorithms, order matters. There are hierarchies that matter when we are working with programming languages. That includes when we are working with Python. Think about this as the order of operations in mathematics. If you recall, we use the mnemonic PEMDAS to remember the order of operations in mathematics. PEMDAS stands for Parentheses, Exponents, Multiplication/Division, and Addition/Subtraction.
I write Multiplication/Division together like this because multiplication and division hold the same weight. That is, multiplication does not necessarily need to happen before division. If I have a division first and then a multiplication from left to right, then the division happens first. The same is true for addition and subtraction. Neither has more weight than the other, so we perform them in order of appearance from left to right.
Let's write a mathematical algorithm for a problem. We'll look at an algorithm in a food setting. And...