Sal's shipping

Hi!
My code is really different from the one on the walkthrough video.
It works this way. But the way Matt explained cheapest method got me confused, especially with \$%.2f and % (cost, method). It was never explained in the course.

Hello @faridsaryev421170057, welcome to the forums! The `%` operator in this case is a type of string formatting operator (not to be confused with the modulo operator-which looks the same (`%`), but is used for a different purpose). I would recommend reading this article on how it is used.

Your code for cheapest shipping method is wrong by the way.
If drone and ground has the same price youâ€™ll end up saying premium is cheapest.

``````def cheapest_option():
ground = 3
drone = 3
if ground < drone and ground < premium:
print("Ground shipping is the better option for you! Your total cost is " + str(ground))
elif drone < ground and drone < premium:
print("Drone shipping is the better option for you! Your total cost is " + str(drone))
else:
print("Premuim ground shipping is the better option for you! Your total cost is " + str(premium))

cheapest_option()
``````

This does happen at weight 3 + 1 / 3 (blue and orange lines crossing)

``````import matplotlib.pyplot as plot

xs = [n / 10 for n in range(350)]
plot.plot(xs, [drone_shipping_price(x) for x in xs], label="drone")
plot.plot(xs, [ground_shipping_price(x) for x in xs], label="ground")
plot.plot(xs, [125 for x in xs], label="premium")
plot.legend()
plot.show()
``````
``````weight = 3 + 1 / 3
print('drone price:', drone_shipping_price(weight))  # 30.0
print('ground price:', ground_shipping_price(weight))  # 30.0
cheapest_option(weight)  # 125.0 ... oops.
``````