• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 1 out of 1 pages
Other

COP1000C Unit 3 Assignment (python)

Document preview thumbnail
Preview 1 out of 1 pages

Assignments involving the use of Decisions A software company sells a package that retails for $99. Quantity discounts are given according to the following table: Quantity Discount 10 - 19 20% 20 - 49 30% 50 - 99 40% 100 or more 50% Design a program that asks the user to enter the number of packages purchased. The program should then display the amount of the discount (if any) and the total cost of the purchase after the discount.

Content preview

Unit 3 Assignment (python)

#Declared variable
package_price = 99


# Prompt user for quantity
quantity = int(input("Enter the number of packages purchased: "))


if quantity >= 100:
discount_rate = 0.50
elif quantity >= 50:
discount_rate = 0.40
elif quantity >= 20:
discount_rate = 0.30
elif quantity >= 10:
discount_rate = 0.20
else:
discount_rate = 0.0
# Calcuate totals
subtotal = quantity * package_price
discount_amount = subtotal * discount_rate
total = subtotal - discount_amount
# Display results
print(f"\nDiscount: ${discount_amount:.2f}")
print(f"\nTotal cost after discount: ${total:.2f}")

Document information

Uploaded on
April 25, 2025
Number of pages
1
Written in
2024/2025
Type
Other
Person
Unknown
$6.59

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
byrena
3.5
(4)
Sold
10
Followers
8
Items
6
Last sold
11 months ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions