2022-01-19

I dont understand how i can take food list which is argument as input to allow price in my dictionary values

Write a Python program to create a dictionary called groceries with the values, items like "rice", "orange", and "apple juice" etc, take at least 5 groceries items. Perform following task:

• Define a function called “calculate_bill” that takes one argument food as input. In the function, create a variable total with an initial value of zero. For each item in the food list, add the price of that item to total. In the end, return the total as output.

• Make the following changes to your calculate_bill function: While you loop through each item of food, only add the price of the item to total if the item's price is greater than 20. Also add 3 more items in your grocery items and remove 2 less price items in your previous groceries item. Fetch the final output



from Recent Questions - Stack Overflow https://ift.tt/3FHicq6
https://ift.tt/eA8V8J

No comments:

Post a Comment