May-28-2020, 10:34 PM
def ground_shipping_cost(weight):
cost = weight * 4.00
return cost
#print(ground_shipping_cost (8.400)+20)
def drone_shipping_cost(weight):
cost = weight * 4.50
return cost
#print(drone_shipping_cost (1.5)) # static
def method_is_cheapest(weight):
ground_ship = ground_shipping_cost (weight)
drone_ship = drone_shipping_cost (weight)
premium_ground_price = 125.00 # static
if (ground_ship < drone_ship) and (ground_ship < premium_ground_price): # ground_ship is cheapest
return ground_ship
elif (drone_ship < ground_ship) and (drone_ship < premium_ground_price): # drone_ship
return drone_ship
elif (premium_ground_price < ground_ship) and (premium_ground_price < drone_ship): #premium_ground_price
return premium_ship
"""
def method_price(weight):
return price
"""
step_6 = method_is_cheapest(4.8)
print_string = "Ship price: " + str(step_6) + "Cheapest ship method: " + str(ship_method)"
print(print_string)
method_is_cheapest(100)Hello all, i would like str(ship_method) to include a string from the return values (ground_ship, drone_ship, or premium_ship), whatever value is returned smallest from the calculation. I am very new to python coming from C
