If your wanting to add a string to the return, you can do this
#! /usr/bin/env python3 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, 'Ground Shipping' # Add string to return elif (drone_ship < ground_ship) and (drone_ship < premium_ground_price): # drone_ship return drone_ship, 'Drone Shipping' # Add string to return elif (premium_ground_price < ground_ship) and (premium_ground_price < drone_ship): #premium_ground_price return premium_ship, 'Premium Shipping' # Add string to return step_6 = method_is_cheapest(4.8) #access the return index print_string = f'Ship Price: {step_6[0]} Cheapest ship method: {step_6[1]}' print(print_string)
Output:Ship Price: 19.2 Cheapest ship method: Ground Shipping
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags