The solution replaces the second line with if num1 > 2 * num2:
Does it mean we always have to put the number before the variable? Because it was basically the same thing.
Multiplication is commutative, meaning it can be done in any order with the same expected result. If the SCT is looking for a specific order, then the author has not given this any consideration. To answer your question, no, we do not have to write the number before the variable.
In maths we usually write a constant before a variable, but this is more by convention to make algebra easier to read and more consistent.
2x^3 + 4x + 1
The constant is also known as a coefficient. Perhaps the author has been following the same general pattern?