Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Instructions In mapped.py complete the mapped Function For input1 and input2 you will be given lists For input1 use the map function to figure out
Instructions
- In mapped.py complete the mapped Function
- For input1 and input2 you will be given lists
- For input1 use the map function to figure out how many even numbers there are
- For input2 use the map function to figure out how many odd numbers there are
- For input3 and input4 you will be given dictionaries
- For input3 use the map function to figure out which keys have even values
- For input4 use the map function to figure out which keys have odd values
- Return the output of each map input
- You must use the map function for each input (4 times)
- Order of inputs and inputs values MUST be preserved
Example
input: [1,8,10], [9,3,4], {'A':1, 'B':2, 'C':3}, {'A':4, 'B':2, 'C':3}
output: ([0, 1, 1], [1, 1, 0], [None, 'B', None], [None, None, 'C'])
Explanation:
# [1,8,10] -> 8 and 10 are even so they get changed to 1
# [9,3,4] -> 9 and 3 are odd so they get changed to 1
# {'A':1, 'B':2, 'C':3} -> 'B' is the only key with an even value so it's the only one that remains unchanged
# {'A':4, 'B':2, 'C':3} -> 'C' is the only key with an odd value so it's the only one that remains unchanged
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