The following function is supposed to take in two lists of equal length containing only integer values, and return a new list where each element is the product of the two corresponding elements in the original. For example, mult_lists([6, 2, 4], [3, 0, 2]) would return [18, 0, 8]. Fill in the blank in the function with a single line of code, such that the function works as intended.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 18PE
icon
Related questions
Question

In python 

The following function is supposed to take in two lists of equal length containing only integer
values, and return a new list where each element is the product of the two corresponding
elements in the original.
For example, mult_lists([6, 2, 4], [3, 0, 2]) would return [18, 0, 8].
Fill in the blank in the function with a single line of code, such that the function works as
intended.
def mult_lists (left, right):
out = []
for i in range (len (left)):
return out
Transcribed Image Text:The following function is supposed to take in two lists of equal length containing only integer values, and return a new list where each element is the product of the two corresponding elements in the original. For example, mult_lists([6, 2, 4], [3, 0, 2]) would return [18, 0, 8]. Fill in the blank in the function with a single line of code, such that the function works as intended. def mult_lists (left, right): out = [] for i in range (len (left)): return out
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Lists
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning