Question To be implemented in d5q1.py: mergeList function: You run a store. You have two lists. The first list contains the items sold by the store, it is a list of strings. The second list contains...


Please write your own code, I'm not understanding


Question<br>To be implemented in d5q1.py: mergeList function:<br>You run a store. You have two lists. The first list contains the items sold by the store, it is a list of strings.<br>The second list contains the quantities of these items, it is a list of strings.<br>We want to build a dictionary of articles and quantities of articles in this store. The dictionary keys are the<br>items, and the values are the respective quantities, of the same index.<br>Lists are not necessarily the same length.<br>- If the list of items is longer, then the dictionary will have zero quantities (= 0) for those items.<br>- If the list of quantities is longer, then the dictionary will contain articles whose name is article_inconnu_i,<br>i being an index:<br>→i starts from 0 until the number of unknown articles - 1.<br>Expand a Python function, called mergeList. This function takes as a parameter<br>the two lists described above. The function returns the constructed dictionary.<br>• To be implemented in d5p1.py in the main program:<br>1- Import d5q1 that you have implemented (use import or from ... import).<br>2- Ask the user to enter the elements of each list separated by commas on the keyboard<br>3- Call the function implemented in d5q1.py by passing it the two lists read on the keyboard<br>4- Display the result as in the examples.<br>Please respect the Example:<br>Please enter the list of items separated by commas:<br>shirt, t-shirt, pants, dress, socks, shoes<br>Please enter a list of quantities separated by<br>commas:<br>20,15,25,30,10,27<br>the store's stock is:<br>{'shirt': '20', 't-shirt': '15', 'pants': '25', 'dress':<br>'30', 'socks': '10', 'shoes': '27'}<br>>>><br>

Extracted text: Question To be implemented in d5q1.py: mergeList function: You run a store. You have two lists. The first list contains the items sold by the store, it is a list of strings. The second list contains the quantities of these items, it is a list of strings. We want to build a dictionary of articles and quantities of articles in this store. The dictionary keys are the items, and the values are the respective quantities, of the same index. Lists are not necessarily the same length. - If the list of items is longer, then the dictionary will have zero quantities (= 0) for those items. - If the list of quantities is longer, then the dictionary will contain articles whose name is article_inconnu_i, i being an index: →i starts from 0 until the number of unknown articles - 1. Expand a Python function, called mergeList. This function takes as a parameter the two lists described above. The function returns the constructed dictionary. • To be implemented in d5p1.py in the main program: 1- Import d5q1 that you have implemented (use import or from ... import). 2- Ask the user to enter the elements of each list separated by commas on the keyboard 3- Call the function implemented in d5q1.py by passing it the two lists read on the keyboard 4- Display the result as in the examples. Please respect the Example: Please enter the list of items separated by commas: shirt, t-shirt, pants, dress, socks, shoes Please enter a list of quantities separated by commas: 20,15,25,30,10,27 the store's stock is: {'shirt': '20', 't-shirt': '15', 'pants': '25', 'dress': '30', 'socks': '10', 'shoes': '27'} >>>
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here