(Solved) : Hi Wanna Write Code Selling T Shirt Online 999 Give Discount Customers Depending Many Shi Q44049072 . . .
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 howmany 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 itpls help!
$$Python program$$
#if purchase 15 or more shirts, multiply by 0.4,asign toshirts
#else if purchase 10 or more shirts, multiply by 0.3, assign toshirts
#else if purchase 4 or more shirts, multiply by 0.2, assign toshirts
#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()
Expert Answer
Answer to 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 …
OR