1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Firdavs [7]
3 years ago
15

The add_prices function returns the total price of all of the groceries in the dictionary. Fill in the blanks to complete this f

unction (python):def add_prices(basket): # Initialize the variable that will be used for thecalculation total = 0 # Iterate through the dictionary items for ___: # Add each price to the totalcalculation # Hint: how do you access thevalues of # dictionary items? total += ___ # Limit the return value to 2 decimal places return round(total, 2)groceries = {"bananas": 1.56, "apples": 2.50, "oranges": 0.99,"bread": 4.59, "coffee": 6.99, "milk": 3.39, "eggs": 2.98, "cheese":5.44}print(add_prices(groceries)) # Should print 28.44
Computers and Technology
1 answer:
Vlada [557]3 years ago
8 0

Answer:

def add_prices(basket):

 

   total = 0

   for items in basket.values():

       total += items

   return round(total, 2)

groceries = {"bananas": 1.56, "apples": 2.50, "oranges": 0.99,"bread": 4.59, "coffee": 6.99, "milk": 3.39, "eggs": 2.98, "cheese":5.44}

print(add_prices(groceries)) # Should print 28.44

Explanation:

The python dictionary is a data structure that stores items of data as a key-value pair. The keys and values can be listed separately using the keys() and values() built-in function.

The program above uses a for loop statement to iterate over the values of the groceries dictionary to return the total sum of the values.

You might be interested in
How many data bits are sent in a single psk31 character?
ololo11 [35]
I would say the number varies.
8 0
3 years ago
Which one of the following is not possible to view in the debug logs?
Usimov [2.4K]

Answer:

Formula field calculations

Explanation:

We can use debug logs to track events in our company, these events are generated if active users have trace indicators.

A debug log can register information about database operations, system processes and errors, in addition, we can see Resources used by Apex, Workflow Rules, Assignment Rule, HTTP calls, and Apex errors, validation rules. The only one we cannot see is Formula field calculations.

8 0
3 years ago
Serveral cheetas are growling at each other while hunting for animals.for which need are they competing?
SVEN [57.7K]

Answer:

prey

Explanation:

5 0
3 years ago
If an employee who needs eye protection wears prescription lenses he or she should
gogolik [260]
Wear Regular glasses not contacts.
5 0
3 years ago
Technician A says that temperature sensors decrease in resistance as the temperature​ increases; this is called positive tempera
Reika [66]

Answer:

Technician B.

Explanation:

The claim of technician B that some vehicle manufacturers use a stepped ECT circuit inside the PCM to broaden the accuracy of the sensor is correct.

6 0
3 years ago
Other questions:
  • Which of the following is an example of subjunctive verb mood?
    5·1 answer
  • Christine wants to send a quick communication to all department managers. She should send a _____. report
    13·2 answers
  • Mr. Olgesandravich is proctoring students working at their own pace in an online class. He is generating a spreadsheet that show
    15·1 answer
  • The part of the computer that provides access to the internet is the?
    14·1 answer
  • The following slide was created as part of a presentation that trains new employees how to use the scheduling and calendar softw
    14·2 answers
  • Which email client feature allows you to store the names and information of people you contact frequently?
    5·1 answer
  • Radar devices are used by law enforcement to be sure that individuals are driving safely. They tell the officer how fast the veh
    12·1 answer
  • Decimal numbers is equivalent to binary 110
    5·1 answer
  • Tommy loves taking care of homing pigeons. He sent a note to his crush who lives 24.0 km away from his house. These birds fly at
    9·1 answer
  • Jim is working on a network design for a small office running a Windows file and printer server with Internet
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!