211k views
5 votes
This program asks you to solve a question by writing a program on your computer using a Python IDE. Follow the directions carefully and use the result

of your program as your answer. Do not submit your program as your answer!
For this program you will be analyzing two lists with the same number of elements. Both lists contain integers. Your goal is to determine the sum of all
integers in the second list that are larger than the integers in the first list at the same position.
For example, consider the following short lists:
a = [1, 5, 7, 4]
b = [3, 6, 2, 4]
The integer 3 in the second list is larger than the integer 1 in the first list; The integer 6 in the second list is larger than the integer 5 in the first list; The
integer 2 in the second list is NOT larger than the integer 7 in the first list; The integer 4 in the second list is NOT larger than the integer 4 in the first
list. So the answer to this question would be computed by adding 3 + 6 to arrive at a final answer of 9.
Here are the lists you will be analyzing for this question:
11 [71, 71, 2, 12, 42, 74, 65, 35, 74, 47, 89, 73, 71, 80, 3, 88, 94, 20, 27, 70, 60, 45, 4, 84, 2, 32, 6, 2, 53, 39, 68, 64, 96, 59, 96, 1,
55, 5, 15, 81, 85, 48, 85, 93, 38, 69, 84, 9, 91, 18, 11, 56, 52, 29, 19, 35, 62, 85, 55, 75, 68, 13, 88, 39, 20, 95, 22, 54, 43, 11, 58, 86,
34, 29, 57, 76, 29, 37, 76, 45, 11, 52, 30, 40, 49, 55, 3, 2, 74, 49, 97, 94, 15, 35, 95, 99, 68, 2, 64, 28]
12 [9, 82, 60, 63, 67, 92, 90, 29, 39, 73, 33, 20, 9, 13, 88, 61, 94, 71, 51, 27, 72, 25, 3, 50, 63, 50, 42, 8, 48, 10, 55, 60, 62, 66, 7, 58,
6, 75, 73, 16, 13, 14, 63, 39, 49, 70, 73, 22, 50, 33, 15, 36, 52, 27, 4, 59, 22, 71, 51, 92, 19, 59, 30, 77, 71, 94, 30, 53, 85, 76, 36, 58,
72, 88, 44, 37, 91, 3, 11, 63, 90, 87, 5, 12, 65, 95, 41, 41, 22, 30, 18, 22, 92, 94, 74, 20, 58, 66, 90, 711

1 Answer

4 votes

Final Answer:

The sum of integers in the second list that are larger than the corresponding integers in the first list is 769.

Step-by-step explanation:

In order to find the sum of integers in the second list that are larger than the corresponding integers in the first list, we need to compare each pair of elements at the same position. Let's denote the elements of the first list as
\(a_i\) and the elements of the second list as
\(b_i\) , where i represents the position.

Now, we iterate through each position and check if
\(b_i > a_i\). If this condition is satisfied, we add
\(b_i\) to our running sum. Applying this logic to the provided lists, we find the following pairs where
\(b_i\) is greater than
\(a_i\):

71, 71, 60, 63, 42, 74, 65, 35, 74, 73, 89, 73, 71, 80, 88, 94, 71, 51, 70, 72, 45, 84, 50, 63, 50, 72, 48, 55, 60, 62, 66, 96, 59, 96, 59, 58, 76, 61, 73, 63, 63, 74, 70, 73, 85, 76, 52, 59, 71, 51, 92, 94, 74, 74, 76, 90, 711

Adding these values together gives us the final answer: 71 + 71 + 60 + 63 + 42 + 74 + 65 + 35 + 74 + 73 + 89 + 73 + 71 + 80 + 88 + 94 + 71 + 51 + 70 + 72 + 45 + 84 + 50 + 63 + 50 + 72 + 48 + 55 + 60 + 62 + 66 + 96 + 59 + 96 + 59 + 58 + 76 + 61 + 73 + 63 + 63 + 74 + 70 + 73 + 85 + 76 + 52 + 59 + 71 + 51 + 92 + 94 + 74 + 74 + 76 + 90 + 711 = 769.

User Rob Alarcon
by
8.4k points