Python If Else Practice Questions
A- Discounts and Pricing
1. Check Discount Eligibility
Write a program to check if a customer is eligible for a discount. If the total purchase is
more than $100, apply a 10% discount and display the final price. Otherwise, display the
total price as it is.
2. Calculate Bulk Discount
If a customer buys more than 5 items, apply a 15% discount on the total price. Otherwise,
no discount is applied. Display the total price.
3. Membership Discount
Check if the customer is a member (is_member = True). Members get a 20% discount;
non-members get a 5% discount. Calculate and print the discounted price.
4. Seasonal Sale
If today is a holiday (is_holiday = True), apply a 25% discount; otherwise, apply a 10%
discount. Calculate the price after discount.
5. Buy-One-Get-One-Free
If a customer buys an even number of items, they get half of them for free. Otherwise,
they pay for all. Calculate the number of items the customer has to pay for.
B- Tax Calculations
6. Sales Tax
If the price of an item is greater than $500, apply a luxury tax of 15%. Otherwise, apply a
standard tax of 8%. Display the total price after tax.
7. Income Tax
If a person's annual income is above $50,000, they pay 20% tax. Otherwise, they pay
10%. Calculate and display the tax amount.
8. Tax Bracket
Write a program to categorize a person into tax brackets:
Income < $30,000: "Low Tax"
$30,000 ≤ Income < $100,000: "Medium Tax"
Income ≥ $100,000: "High Tax"
9. VAT Calculation
If the item is marked as essential (is_essential = True), apply a VAT of 5%. Otherwise,
apply a VAT of 12%. Display the final price.
10. Tax-Free Day
If today is a tax-free day (tax_free = True), display the original price. Otherwise, add a
7% tax.
C- Shopping and Billing
11. Free Shipping
If the total purchase amount is more than $50, offer free shipping; otherwise, charge $5
for shipping. Display the total amount including shipping.
12. Discount Code
If a customer enters the correct discount code (DISCOUNT10), apply a 10% discount.
Otherwise, charge the full amount.
13. Tiered Discounts
Apply discounts based on the total price:
$0–$50: No discount.
$50–$100: 10% discount.
Over $100: 20% discount.
14. Minimum Purchase Requirement
If the total amount is less than $20, display a message: "Minimum purchase of $20 is
required." Otherwise, display the total amount.
15. Loyalty Points
If a customer is a loyal member (is_loyal = True), they earn double loyalty points for
their purchase. Otherwise, they earn standard points.
D- Travel and Tickets
16. Travel Discount
If a person is traveling more than 500 miles, offer a 20% discount on ticket price.
Otherwise, charge the full amount.
17. Child or Senior Discount
If a passenger is under 12 or over 60 years old, apply a 15% discount on the ticket price.
Otherwise, charge the full price.
18. Ticket Type Pricing
If the ticket is for a weekend (is_weekend = True), add a 10% surcharge. Otherwise,
charge the standard price.
19. Baggage Fee
If the total baggage weight is over 20kg, charge $10 per extra kilogram. Otherwise, no
extra fee.
20. Early Bird Discount
If a ticket is booked more than 30 days in advance, apply a 10% discount. Otherwise,
charge the full price.
E- Grades and Performance
21. Pass or Fail
If a student scores 40 or more, print "Pass". Otherwise, print "Fail".
22. Grade Assignment
Based on a student's score, assign grades:
90 and above: "A"
75–89: "B"
50–74: "C"
Below 50: "F"
23. Bonus Marks
If a student completes all assignments, add 5 bonus marks to their score. Otherwise, no
bonus marks.
24. Attendance Eligibility
If a student's attendance is 75% or more, they are eligible to take the exam. Otherwise,
they are not.
25. Scholarship Eligibility
If a student's grade is "A" and their annual family income is below $30,000, they are
eligible for a scholarship. Otherwise, they are not.