Asked by hariskhaan
please help me in solving this question step by step and the code...
please help me in solving this question step by step and the code should be general code not a hard code..Thanks
Image transcription text
Define the following two dictionaries: stock = { "banana": 6, "apple": 0, "orange": 32, "pear": 15 } prices = { "banana": 4, "apple": 2, "orange": 1.5, "pear": 3 } Create a function compute_bill that takes a list (of fruits) as an argument. In the function, create a variable total with an initial value of zero. For each item in the fruit list, only add the price of the item to total if the item's stock count is greater than zero. If the item is in stock and after you add the price to the total, subtract one from the item's stock count. Return the total amount from the function.
Answered by NyxAlexa
e ve
gue
m ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac m
ec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus aUnlock full access to Course Hero
Explore over 16 million step-by-step answers from our library
Subscribe to view answeronec aliquet. Lorem ipsum dolo
, ultrices ac magna. Fusce dui le
facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam la