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
Nuetrik [128]
3 years ago
8

Given two lists of integers, write a function multLists(list1, list2) that multiplies each value of the list1 by the values of l

ist2 and returns list1 with it's updated values. The lists will be obtained for you, just write the function and print the result.
Computers and Technology
1 answer:
Fynjy0 [20]3 years ago
3 0

Answer:

FIRST SOLUTION

def multLists(list1,list2):

   for i in range(len(list1)):

       list1.append(list1[i]*list2[i])

   return list1

SECOND SOLUTION

def multLists(list1,list2):

   newlist = [ ]

   for i in range(len(list1)):

       newlist.append(list1[i]*list2[i])

   return newlist

Explanation:

First we define the function and call it MultLists. Then using a for statement, we loop through the list the number of times that is equivalent to the length of the list1. In the first solution, we append the element-wise multiplication in the two list and append this to list1. The return of the first solution, is list1 which contains list1 in addition to the product of the elements from list1 and list2

In the second solution, we create a new list, and using the append function, we populate it with the values of the element-wise multiplication from the two lists. The return of the second solution, is a new containing only to the product of the elements from list1 and list2

You might be interested in
A technician is troubleshooting a computer that will not communicate with any hosts on the local network. While performing a vis
tangare [24]

Answer:

Assuming that D is correct, the other answer is C.

Explanation:

<em>I used Dell Support to confirm this.</em>

It states that if the lights are off, it is not detecting the network and no connection is in place. You would want to confirm the NIC is enabled in the BIOS (as C states).

I hope this helps!

8 0
3 years ago
The interprets the data while it is in RAM​
Katena32 [7]

Answer:

The input interprets the data while it is in RAM.

Explanation:

5 0
3 years ago
EASY QUESTIONS! 10 POINTS AND BRAINLIEST FOR BEST ANSWER! PLEASE HELP ANSWER THIS only if you know BOTH ANSWERS!
Illusion [34]

Answer:

chain also why would some knock on their own dang door lol

Explanation:

it's easy indeed

8 0
4 years ago
Read 2 more answers
Where does append add the new elements?
ZanzabumX [31]

Answer:

"Option 1: To the end of an array." is the correct answer.

Explanation:

The word "Append" means adding to the end of a document.

Appending means whatever new content is added, it is added at the end of the document or data structure.

Similarly,

Appending an array means adding new elements to the end of the array.

Hence,

"Option 1: To the end of an array." is the correct answer.

7 0
3 years ago
When do you use an else statement?
tatiyna

Answer:

To tell what will happen when an if-statement is false

Explanation:

We use else statement if if-statement get false.

for example

if(a>20)

{

print "your age is greater than 20"

}

else

{

print "Your age is less than 20"

}

In the pseudo code, you see the use of else statement, that if age is greater than 20 then display message "you are age is greater than 20". if this statement get false, i.e. you are age is not greater than 20 then else statement will be executed and message will be displayed that your age is less than 20.

Why other option are not correct

To input a variable:

to get input, we use input statement of respective programming language not if-else statement.

To end an if statement

we don't use else statement to end if statement. when condition met then if statement will be ended

To handle string value

we use input validation statement to handle if statement.

8 0
3 years ago
Other questions:
  • When desktop publishing software can interact with another software program, the two are said to
    6·1 answer
  • Are the ways data represented and transmitted with computer law of nature or by law of man?
    12·1 answer
  • Page _____ refers to whether a page is laid out vertically or horizontally.
    12·1 answer
  • Heeeaaaalp please!!!!
    15·2 answers
  • Although architects frequently do most of their work in an office, what might motivate an architect to work from the jobsite?
    7·1 answer
  • Why do ineed to upgrade to see answers isnt it enough adds
    15·2 answers
  • Predict the future that social media will have on society or the environment
    12·1 answer
  • What is the grade, as a percentage with two digits after the decimal point, obtained when you graded this 101-question multiple-
    13·1 answer
  • Which of the formulas below are valid? Select all that apply?
    9·1 answer
  • What was Ada Lovelace's contribution to computer science?
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!