To handle all the cases, we’ll use an if-elif statement. Notice that we only need to specify the lower bound in each condition. This is because, for every condition, the upper bound is already being checked in the previous condition.
The program will only go into the first elif if the price is lower than 300.
This sort of smart structuring in a conditional statement can be very useful when dealing with a large number of complex cases.
The price after a discount would be price * (1 - discount).