weight = 41.5 #ground shipping if weight <= 2: ground_cost = 1.50 elif weight <= 6: ground_cost = 3.00 elif weight <= 10: ground_cost = 4.00 else: ground_cost = 4.75 ground_cost_total = 20 + (ground_cost * weight) print(ground_cost_total) ground_shipping_premium = 125.00 print("ground shippoing premium $",ground_shipping_premium) #drone shipping if weight <= 2: drone_cost = 4.50 elif weight <= 6: drone_cost = 9.00 elif weight <= 10: drone_cost = 12.00 else: drone_cost = 14.25 drone_cost_total = drone_cost * weight print(drone_cost_total)`Preformatted text`
Welcome to the forums. Please remember to format your code when asking questions.
Did you have a specific question about the project?
The point of writing functions is so that you can re-use those bits of code logic…and you can pass through any arguments when you call the function(s).
this was very helpful thank you. To answer your question, no I do not have a specific question but the reason that I have opted out of using functions in this code is because on the Learn Python 3 pathway where I encountered the test I have realized that Sal’s shipping test is before the pathway teaches about functions and without prior knowledge of functions and the examples in the forum use functions doing this test could be rather difficult.
Oh, huh. I had no idea.
That’s really weird b/c I had done this project and didn’t realize they’d moved it in the syllabus to come before functions.
This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.