Question: Scenario: You are developing a simple shopping cart system for an online store. The cart needs to calculate the total cost of the items, including

Scenario:
You are developing a simple shopping cart system for an online store. The cart needs to calculate the total cost of the items, including a discount if the total exceeds a certain amount.
Question:
Write a Python program that:
Takes the prices of items in the cart as input.
If the total exceeds $100, applies a 10% discount.
Prints the total cost after applying the discount (if any).
Sample Input/Output:
Input: prices =[50,60,30]
Output:
Total cost: $126.00(10% discount applied)
Group of answer choices
prices =[50,60,30]
total = sum(prices)
if total >100:
discount = total -100
total -= discount
print(f"Total cost: ${total:.2f}(Discount applied)")
else:
print(f"Total cost: ${total:.2f}")
prices =[50,60,30]
total = sum(prices)
if total >100:
discount = total *0.10
total -= discount
print(f"Total cost: ${total:.2f}(10% discount applied)")
else:
print(f"Total cost: ${total:.2f}")
prices =[50,60,30]
total = sum(prices)
if total >=100:
discount = total *0.10
total -= discount
print(f"Total cost: ${total:.2f}(10% discount applied)")
else:
print(f"Total cost: ${total:.2f}")
prices =[50,60,30]
total = sum(prices)
if total >100:
discount =10
total -= discount
print(f"Total cost: ${total:.2f}($10 discount applied)")
else:
print(f"Total cost: ${total:.2f}")

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 Programming Questions!