You must select a tag to post in this category. Please find the tag relating to the section of the course you are on E.g. loops, learn-compatibility
When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!
If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer!
I have completed the project however for the two test statements I get an output of none for one of them and I don’t know why. Link to task:
def cost_g_shipping(weight): if (weight <= 2): price_pound = 1.50 elif weight <= 6: price_per_pound = 3.00 elif weight <= 10: price_per_pound = 4.00 else: price_per_pound = 4.75 return 20 + (price_per_pound * weight) shipping_cost_premium = 125.00 def cost_d_shipping(weight): if (weight <= 2): price_per_pound = 4.50 elif weight <= 6: price_per_pound = 9.00 elif weight <= 10: price_per_pound = 12.00 else: price_per_pound = 14.25 return price_per_pound * weight #print(cost_d_shipping(1.5)) def cheapest_method(weight): ground_cost = cost_g_shipping(weight) premium_cost = shipping_cost_premium drone_cost = cost_d_shipping(weight) if (ground_cost < premium_cost) and (ground_cost < drone_cost): method = 'Standard Ground' cost = ground_cost elif (drone_cost<ground_cost) and (drone_cost<premium_cost): method = 'Drone' cost = drone_cost else: method = 'Premium' cost = premium_cost print('The cheapest shipping method for you is $%.2f with %s Shipping.' %(cost, method)) print(cheapest_method(41.5)) print(cheapest_method(4.8))
For the input of 4.8lbs it prints ‘None’, it should print $34.40. Where did I go wrong?