100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Other

COP1000C Unit 3 Assignment (python)

Rating
-
Sold
-
Pages
1
Uploaded on
25-04-2025
Written in
2024/2025

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.

Show more Read less








Whoops! We can’t load your doc right now. Try again or contact support.

Document information

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

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}")

Get to know the seller

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
View profile
Follow You need to be logged in order to follow users or courses
Sold
10
Member since
2 year
Number of followers
8
Documents
6
Last sold
1 month ago

3.5

4 reviews

5
1
4
1
3
1
2
1
1
0

Recently viewed by you

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

Frequently asked questions