One of the outputs does not appear in the Sal's Shipping project

hello, ı working in the sal’s shipping project but ı I have a problem:
when there is no problem with the over 10 pounds, but some outputs are not visible in under 10 pounds, can you help?

project: https://www.codecademy.com/courses/learn-python-3/projects/python-sals-shipping

my code:

weight = 4.8

#Ground Shipping
if weight <= 2:
cost_ground = weight * 1.50 + 20
elif weight <= 6:
cost_ground = weight * 3.00 + 20
elif weight <= 10:
cost_ground = weight * 4.00 + 20
else:
cost_ground = weight * 4.75 + 20
print(“Ground Shipping $”, cost_ground)

#Ground Shipping Premium
(cost_ground_premium) = 125.00

print(“Ground Shipping Premium $”, cost_ground_premium)

#Drone Shipping
if weight <= 2:
cost_drone_shipping = weight * 4.5
elif weight <= 6:
cost_drone_shipping = weight * 9.0
elif weight <= 10:
cost_drone_shipping = weight * 12.0
else:
cost_drone_shipping = weight * 14.25
print(“Drone Shipping $”, cost_drone_shipping)

the output i should get:

Ground Shipping $ 34.4
Ground Shipping Premium $ 125.0
Drone Shipping: $ 43.199999999999996

The output I got:

Ground Shipping Premium $ 125.0
Drone Shipping $ 43.199999999999996

To preserve code formatting in forum posts, see: [How to] Format code in posts

Could it be that you wrote

else:
    cost_ground = weight * 4.75 + 20
    print("Ground Shipping $", cost_ground)

instead of

else:
    cost_ground = weight * 4.75 + 20
print("Ground Shipping $", cost_ground)

?
In the former case, the print statement is part of the else block, whereas in the latter situation, the print statement is outside the if-elif-else statement.

3 Likes