This Python code processes transactions for vegetable purchases from multiple clients. It initializes variables to track total clients, highest amount paid, and lowest amount paid. It defines functions to calculate totals for individual products, subtotals before/after taxes, and final totals accounting for discounts. The main loop greets each client, gets their vegetable purchases, calculates various totals, prints a bill, and updates the tracking variables. At the end it prints a summary of totals processed, highest amount, and lowest amount.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
14 views2 pages
Sodapdf
This Python code processes transactions for vegetable purchases from multiple clients. It initializes variables to track total clients, highest amount paid, and lowest amount paid. It defines functions to calculate totals for individual products, subtotals before/after taxes, and final totals accounting for discounts. The main loop greets each client, gets their vegetable purchases, calculates various totals, prints a bill, and updates the tracking variables. At the end it prints a summary of totals processed, highest amount, and lowest amount.
while True: # Greet the client ClientFN = input("Enter client’s full name (or ’q’ to quit): ") if ClientFN.lower() == ’q’: break
TotalClients += 1 # Increment the total number of clients processed
# Display available vegetables and their prices
vegetables = {"Tomatoes": 12, "Potatoes": 15, "Carrots": 19, "Celery": 21, "Onions": 25} print("\nAvailable Vegetables:") for veg, price in vegetables.items(): print(f"{veg}: {price} DH per Kg")
# Get the name and quantity of 3 vegetables
V1 = input("Enter the name of the first vegetable: ") V1Q = float(input(f"Enter the quantity of {V1} in Kg: ")) V2 = input("Enter the name of the second vegetable: ") V2Q = float(input(f"Enter the quantity of {V2} in Kg: ")) V3 = input("Enter the name of the third vegetable: ") V3Q = float(input(f"Enter the quantity of {V3} in Kg: "))