Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!