Programming Assignment Unit 2
Programming Assignment Unit 2
PART 1
places.
5. Output: The result is printed in a formatted string that shows the radius and the
6. Function Calls: The function is called three times with different radius values (5, 10, and
Output:
PART 2
return total_price
# Example purchases
individual_purchase = ['item1'] # No discount
combo_purchase = ['item1', 'item2'] # 10% discount
gift_pack_purchase = ['item1', 'item2', 'item3'] # 25% discount
# Calculate totals
total_individual = calculate_total_price(item_prices, individual_purchase)
total_combo = calculate_total_price(item_prices, combo_purchase)
total_gift_pack = calculate_total_price(item_prices, gift_pack_purchase)
2. Price Calculation: The total price is calculated by summing the prices of the items in
3. Discount Application:
If the customer purchases a gift pack (all three items), a 25% discount is applied.
4. Return Value: The function returns the total price after applying any applicable
discounts.
6. Formatted Output: The results are printed in a formatted manner, showing the total
SOURCES:
"Don't Make Me Think: A Common Sense Approach to Web Usability" by Steve Krug