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, 21.06.2019 17:30
Think about the poem "old ironsides." drag the subject of the poem to the subject box and the theme to the theme box. then decide whether each excerpt from the poem supports the subject or the theme.
Answers: 3
question
Computers and Technology, 23.06.2019 07:30
What is the original authority for copyright laws
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
Jake really works well with numbers and is skilled with computers but doesn't work well with others. which of the jobs discussed in this unit might be best for jake? why?
Answers: 3
question
Computers and Technology, 23.06.2019 21:00
Which task uses a simple parameter?
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
Mathematics, 02.09.2019 01:00
question
Physics, 02.09.2019 01:00
question
Social Studies, 02.09.2019 01:00
Questions on the website: 13722360