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]

in python plz

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 21:00
You turn your computer on and the computer will not boot up where is something you should do to diagnose the problem?
Answers: 1
question
Computers and Technology, 22.06.2019 19:10
10. when you create a pivottable, you need to specify where to find the data for the pivottable. is it true
Answers: 2
question
Computers and Technology, 23.06.2019 17:00
Companies that implement and apply an information system effectively can create
Answers: 1
question
Computers and Technology, 24.06.2019 04:30
Fall protection, confined space entry procedures, controlled noise levels, and protection from chemical hazards are some of the things that contribute to a safe and
Answers: 1
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
Questions on the website: 13722360