Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assume that a firm uses a nested dictionary to maintain the information on annual sales made from various sales strategies for 2018, 2019, and 2020.
Assume that a firm uses a nested dictionary to maintain the information on annual sales made from various sales strategies for 2018, 2019, and 2020.
sales_3_years = {'2018': {"Radio Sales": 5000, "TV Sales": 26000, "Direct-Mail Sales": 1000, "Telephone Sales": 26000}, '2019': {"TV Sales": 26000, "Online Sales": 37000, "Telephone Sales": 9000, "Radio Sales": 3000}, '2020': {"Telephone Sales": 8000, "TV Sales": 19000, "Online Sales": 107000}}
Write a (possibly nested) for loop to answer: How many distinct strategies have been used? What are the total sales made from them for the 3 consecutive years? Store your result in a dictionary that looks like the following (the order in which entries are listed can be different):
{'Radio Sales': 8000, 'TV Sales': 71000, 'Direct-Mail Sales': 1000, 'Telephone Sales': 43000, 'Online Sales': 144000}
Hint: think about using dict.get()
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started