We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
def main(): # Get quantity in pounds quantity = int(input('Enter the quantity of coffee in pounds.')) # Calculate the cost of the coffee using if else structure if quantity >= 40: cost = quantity * 7.5 else: if quantity >= 20: cost = quantity * 8.75 else: if quantity >= 10: cost = quantity * 10.0 else: if quantity < 10: cost = quantity * 12.0 else: print('You did not enter a valid quantity.') # Calculate sales tax salesTax = cost * .07 # Calculate shipping fee if cost > 150.0: shippingFee = 0 else: shippingFee = quantity * 1.0 # Calculate Total Payable ttlPayable = cost + salesTax + shippingFee print('Cost of coffee = $', format(cost, ',.2f'), sep ='') print('7% Sales Tax = $', format(salesTax, ',.2f'), sep='') print('Shipping fee = $', format(shippingFee, ',.2f'), sep='') print('Total payable = $', format(ttlPayable, ',.2f'), sep='') main()
Add your voice to the tech community where 5M+ people just like you are talking about what matters.