Question: Hi I wanna write a code about selling a T-shirt online for $9.99/each. I will give a discount to my customers depending on how many

Hi I wanna write a code about selling a T-shirt online for $9.99/each. I will give a discount to my customers depending on how many shirts they buy it.

40% off for 15 or more shirts

30% off for 10 or more shirts

20% off for 4 or more shirts

However, the shipping and handing will be charged for $1.05/ shirts.

Here the code that I wrote but there was something wrong with it pls help!

$$Python program$$

#if purchase 15 or more shirts, multiply by 0.4,asign to shirts #else if purchase 10 or more shirts, multiply by 0.3, assign to shirts #else if purchase 4 or more shirts, multiply by 0.2, assign to shirts #else multiply by 0.1, assign to shirts #shipping and handling = shirts * 1.05

def main(): ### get number of shirts from customer shirts = int(input('How many shirts are you purchasing')) ### the prices price = shirts * 9.99 ### determine the cost of shirts if shirts >= 15: discount= price * 0.4 elif shirts >= 10: discount= price * 0.3 elif shirts >= 4: discount= price * 0.2 else: discount= price * 0.1

### determine shipping and handling if shirts >= 15: shippingCharges = shirts * 1.05 else: shippingCharges = shirts * 1.05

### compute total amount due total = price - discount + shippingCharges

### display outputs in currency format print('Cost of shirts $',format(price,'.2f'),sep='') print('Cost of shirts after sales $',format(discount,'.2f'),sep='') print('Cost of shipment $',format(shippingCharges,'.2f'),sep='') print('Total payment $',format(total,'.2f'),sep='')

main()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!