subject

1. Write a function called sum_arrays that takes two lists of the same length and returns a list where each element is the sum of the elements at that index in the original list. The function should return the empty list if the parameters are not the same size Sample Run 1:
a = [1, 2, 3, 4, 5]
b = [10, 20, 30, 40, 50]
print(sum_arrays(a, b))

Should output:
[11, 22, 33, 44, 55]

Sample Run 2:
a = [1, 2, 3, 4, 5]
b = [10, 20, 30, 40, 50, 60]
print(sum_arrays(a, b))

Should output:
[]

2. Write a function called replace_elem that takes an array and two values and uses the simple search algorithm to replace all instances of the first value with the second value
Sample Run 1:
a = [7, 4, 10, 3, 7, 2, 4, 5]
print(replace_elem(a, 4, 6))

Should output:
[7, 6, 10, 3, 7, 2, 6, 5]

Sample Run 2:
a = [7, 3, 10, 3, 7, 2, 9, 5]
print(replace_elem(a, 4, 6))

Should output:
[7, 3, 10, 3, 7, 2, 9, 5]

hel plz in python

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 23:00
In which part of a professional email should you try to be brief, but highly descriptive?
Answers: 1
question
Computers and Technology, 24.06.2019 06:30
Some peer-to-peer networks have a server and some don't. true false
Answers: 2
question
Computers and Technology, 24.06.2019 06:30
Adrawing that places all lines parallel to the z axis at an angle from the horizon is 99 ! a. an oblique drawing b. a perspective drawing c. an auxiliary view d. a one-point perspective drawing
Answers: 2
question
Computers and Technology, 24.06.2019 17:30
Looking at the electroscope, describe how you can cause the two leaves at the bottom to repel each other and stay that way
Answers: 3
You know the right answer?
1. Write a function called sum_arrays that takes two lists of the same length and returns a list whe...
Questions
question
History, 21.07.2019 15:40
Questions on the website: 13722359