Python Programming Exercises
Python Programming: Control Statements
Question 1
Write a Python program that asks for:
➢ Total amount purchased
➢ Type of customer (regular or premium)
Apply discounts based on the following rules:
If the customer is premium and the amount is 1000, apply 20% discount. If the amount is less
than 1000 apply 10% discount
If the customer is regular and the amount is over 1000, apply 10% discount, if the amount is
less than 100 apply 5% discount
Display the details such as type of customer, percentage of discount , discount amount and
the final amount after discount.
Question 2
Undergraduate Fees Based on Final Exam Scores & Payment Plan
Write a Python program that asks for:
➢ Average final exam score (out of 100)
➢ Payment plan (full or instalment)
Apply fee structure:
If score over 75:
Full payment = R8000
Installment = R8500
If score is less than 75:
Full payment = R10000
Instalment = R11000
Print the selected payment method and total fees.
Python Programming Exercises
Question 3
Transport Fare (Bolt) Based on Age, Distance, & Payment Type
Write a program that prompts the user for:
➢ Age
➢ Distance to travel (in km)
➢ Payment method (cash or card)
Apply Fare rules:
➢ Base rate is R5 per km
➢ If ages between 20 and 40 apply 10% discount
➢ If the age is between 40 and 60 apply 15% discount
➢ If the age is above 60 above 20% apply 20% discount
➢ If payment is by card, add R5 service charge
Display the details of the ride such as the discount percentage, discount, payment type and
total fare.
Question 4
Telephone Charge Based on Hours, Subscription, and Payment Type
Write the program that ask the user for:
➢ Number of hours used for a telephone
➢ Type of subscription (basic, premium)
➢ Payment method (cash, card)
Apply the rules Rules:
Basic: R20 per hour
Premium: R15 per hour
For Basic Users apply 10 % for total charge over 2500.
For Premium users, If the total charge is over 5000 apply 10 % discount and If
charge is between 2000 and 5000 apply 5% discount.
If paying by card, add R50 processing fee.
Minimum payable fee is R500
Display the details: Total charge, discount percentage, discount amount, total amount, and
card fee if applicable.
Python Programming Exercises
Question 5
Product Discount Based on Customer Type and Amount
Write a program that ask a user for:
➢ Total amount of purchase
➢ Customer type (new, loyal)
Apply these Rules:
For Loyal customers if the total amount payable is over R1500 apply 25% discount, if the
amount is less that R1500 apply 15% discount.
For New customers if the total amount payable is over R1500 apply 10% discount, if the
amount is less that R1500 no discount is given.
Display the details of the purchase including the percentage of discount given, discount and
discounted price.