Valid Foundations-of-Programming-Python Dumps shared by EduDump.com for Helping Passing Foundations-of-Programming-Python Exam! EduDump.com now offer the newest Foundations-of-Programming-Python exam dumps, the EduDump.com Foundations-of-Programming-Python exam questions have been updated and answers have been corrected get the newest EduDump.com Foundations-of-Programming-Python dumps with Test Engine here:
A dictionary prices = { ' apple ' : 1.50, ' banana ' : 0.75, ' orange ' : 2.00} needs to have all values increased by 0.25. Which code correctly accomplishes this task?
Correct Answer: A
In Python, iterating directly over a dictionary gives itskeys. In this dictionary, the keys are: ' apple ' ' banana ' ' orange ' To update each price, the program can loop through each key and use that key to access and change the corresponding value. Correct code: prices = { ' apple ' : 1.50, ' banana ' : 0.75, ' orange ' : 2.00} for item in prices: prices[item] = prices[ item] + 0.25 print(prices) Output: { ' apple ' : 1.75, ' banana ' : 1.0, ' orange ' : 2.25} Option B is incorrect because value actually receives each dictionary key, not each dictionary value. Also, assigning to value would not update the dictionary. Option C is incorrect because item is not defined, and the loop structure is invalid for this task.