:https://gist.github.com/27202881c697c825dc09c69589aeb18c
this is a project from functions called sal’s shipping form python 3 course.
please let me know where I went wrong in this.
:https://gist.github.com/27202881c697c825dc09c69589aeb18c
this is a project from functions called sal’s shipping form python 3 course.
please let me know where I went wrong in this.
Are you getting any error messages? Analyzing those might really help you find the error by yourself
no. there is no error. it just displays NONE.
I believe this part of the code should not be indented
if ground_shipping_charges <= premium_shipping_charges and ground_shipping_charges <= drone_shipping_charges :
print("The cheapest shipping is ground shipping and the cost is " + str(ground_shipping_charges) +" dollars.")
elif drone_shipping_charges <= ground_shipping_charges and drone_shipping_charges<= premium_shipping_charges:
print("The cheapest shipping is drone shipping and the cost is " + str(drone_shipping_charges) +" dollars.")
else:
print("The cheapest shipping is premium shipping and the cost is " + str(premium_shipping_charges) +" dollars.")
You have those conditions inside your last else
statement, so you’re only telling the user which shipping method is the best when the package is a certain weight.
Hope this helped.
It might be helpful to revisit how to use if elif else
https://www.codecademy.com/learn/learn-python-3/modules/learn-python3-control-flow/cheatsheet
And, you might need more than one function for this exercise.
This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.