1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lesya [120]
3 years ago
15

Write a new version (called map2) of the map function which operates on two lists. Your function should accept three parameters,

a function f and two lists X and Y , and return a new list composed of the function f applied to corresponding elements of X and Y . For concreteness, place the function first among the parameters, so that a call to the function appears as (map2 f X Y). Your function may assume that the two lists have the same length. In particular, given two lists (x1 x2 . . . xn ) and ( y1 y2 . . . yn ) (and the function f ), map2 should return
Computers and Technology
1 answer:
storchak [24]3 years ago
7 0

Answer:

def mapper( a, b ):

   return dict(zip(a,b))

def map2 ( f, x : list, y: list ) ->dictionary:

   mapped_lists = f( x, y )

   new_list = [ ]

   for key, value in mapped_lists.iteritems():

       items = [key,value]

       new_list.append(items)

   return new_list

result = map2( mapper, x, y )

print( result )

Explanation:

The "map2" python function defined above maps two lists of the same length. It receives two iterators or lists and a function and returns a list of mapped items from both lists.

You might be interested in
If I wanna records a game and my voice need to be in the video what app I download.
saveliy_v [14]
<span>Video Editor & Movie Maker App</span>
8 0
4 years ago
Read 2 more answers
To have a set of command
GalinKa [24]

Every program that interacts with people responds to a specific set of commands. The set of commands and the syntax for entering them is called the user interface and varies from one program to another. The DOS operating system makes a distinction between internal and external commands.

3 0
3 years ago
The acronym GUI is short for
Y_Kistochka [10]
Graphical user interface.

Hope I helped :)
4 0
3 years ago
Solve the equation w - 2 = -3<br><img src="https://tex.z-dn.net/?f=w%20%3D%20%20%20-%20%20%5Cfrac%7B3%7D%7B2%7D%20" id="TexFormu
Andreyy89
Heres my answer w= -1
4 0
3 years ago
The operating system of a computer is an example of ________ software. science-forum
Aleks [24]
Os (Operating system) <span>The operating system of a computer is an example of OS software. </span>
8 0
3 years ago
Other questions:
  • python Write a class named Taxicab that has three **private** data members: one that holds the current x-coordinate, one that ho
    10·1 answer
  • Longer speeches should be separated into the paragraphs of:
    9·1 answer
  • In a transaction-processing system (tps), if the tps database can be queried and updated while the transaction is taking place,
    11·1 answer
  • Imagine a situation where two developers are simultaneously modifying three different software components. what difficulties mig
    11·1 answer
  • What is one reason the SOC categorizes occupations as it does?
    9·1 answer
  • Which setting on a profile makes a tab NOT accessible in the All App Launcher or visible in any app, but still allows a user to
    11·1 answer
  • An increase in the Money Supply will increase the Aggregate Price Level and will also increase which of the following?
    14·1 answer
  • I am on windows 10 OS. I have been trying to figure this out for ages! I want to get my task bar (on the bottom of the screen) t
    14·2 answers
  • The character you control enters the Mystic Palace. Once inside, you find that the game’s world turns upside down. Standing on t
    9·2 answers
  • What is the output?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!