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 14:00
Rint "censored" if userinput contains the word "darn", else print userinput. end with newline. #include #include using namespace std; int main() { string userinput; userinput = "that darn cat."; /* your solution goes here */ return 0; }
Answers: 1
question
Computers and Technology, 22.06.2019 03:30
Identify at least three types of characteristics that you were asked about as you the computer identify a fruit.
Answers: 3
question
Computers and Technology, 23.06.2019 16:50
15: 28read the summary of "an indian's view of indian affairs."15 betterin "an indian's view of indian affairs," it is asserted that conflicts could be reduced if white americansunderstood native americans..pswhich of the following would make this summary more complete? eleo the fact that chief joseph believes the great spirit sees everythinthe fact that chief joseph was born in oregon and is thirty-eight years oldo the fact that chief joseph states that he speaks from the hearthehehethe fact that chief joseph of the nez percé tribe made this claimebell- ==feetle===-felsefe ==submitmark this and retum.=
Answers: 3
question
Computers and Technology, 23.06.2019 20:30
What is the biggest difference between section breaks and regular page breaks
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
question
English, 21.10.2021 02:40
question
English, 21.10.2021 02:50
question
Mathematics, 21.10.2021 02:50
question
Mathematics, 21.10.2021 02:50
question
Mathematics, 21.10.2021 02:50
question
Mathematics, 21.10.2021 02:50
Questions on the website: 13722361