Question: How do I solve this python code? A grocery shopping program. The program receives input about products purchased, calculates the amount due and displays it

How do I solve this python code?

"""A grocery shopping program.

The program receives input about products purchased,

calculates the amount due and displays it back to the user"""

# Known products and their unit prices

GROCERY_PRICES = {

"tomato": 2.99,

"bread": 1.59,

"chicken": 10.78,

"beef": 15.69,

"potato": 5.47,

"apple": 1.57,

}

def get_amount_due(groceries):

"""Calculate the amount due for the specified list of groceries

The prices of the known products are provided in the GROCERY_PRICES

global variable

Args:

groceries(list): A list of groceries, each being a two-item tuple

containing the name of a product and the number of

items purchased

Returns:

float: The amount due

"""

# Your code goes here

pass

def main():

"""Get input from the user about the products purchased and

display the amount due on the screen.

The products must be one of the known products contained

in the GROCERY_PRICES global variable

The user is prompted for input continuously until they answer

'no' when asked to add another entry.

"""

# Your code goes here

pass

if __name__ == "__main__":

grocery_list = [

("tomato", 5),

("chicken", 1),

("potato", 2),

]

# get_amount_due

# amount = get_amount_due(grocery_list)

# print(amount)

# main program

# main()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!