🐍 Python Code
# EXAMPLE 7:
# SUPERMARKET FRUIT BILL
# Step 1: First fruit information
fruit1 = input("Enter first fruit name: ")
price1 = float(input("Enter price per kg: "))
kg1 = float(input("Enter kilogram: "))
# Calculate first fruit cost
cost1 = price1 * kg1
# Step 2: Second fruit information
fruit2 = input("Enter second fruit name: ")
price2 = float(input("Enter price per kg: "))
kg2 = float(input("Enter kilogram: "))
# Calculate second fruit cost
cost2 = price2 * kg2
# Step 3: Third fruit information
fruit3 = input("Enter third fruit name: ")
price3 = float(input("Enter price per kg: "))
kg3 = float(input("Enter kilogram: "))
# Calculate third fruit cost
cost3 = price3 * kg3
# Step 4: Calculate total cost
total_cost = cost1 + cost2 + cost3
tax = total_cost * 0.15
net_amount = total_cost + tax
# Step 5: Display receipt
print("\n======== FRUIT RECEIPT ========")
print(fruit1, "=", cost1, "Birr")
print(fruit2, "=", cost2, "Birr")
print(fruit3, "=", cost3, "Birr")
print("------------------------------")
print("Total Fruit Cost =", total_cost, "Birr")
print("Tax (15%) =", tax, "Birr")
print("Net Amount =", net_amount, "Birr")
🤖 Python Output
Enter first fruit name: Banana
Enter price per kg: 100
Enter kilogram: 2
Enter second fruit name: Orange
Enter price per kg: 50
Enter kilogram: 3
Enter third fruit name: Apple
Enter price per kg: 90
Enter kilogram: 2
Banana = 200 Birr
Orange = 150 Birr
Apple = 180 Birr
Total Fruit Cost = 530 Birr
Tax (15%) = 79.5 Birr
🎉 Net Amount = 609.5 Birr