Question 6
You have a list of lists:You want to compute the sum of all even numbers greater than 3. Consider the two code snippets below (with the condition left blank):Snippet-1s = 0 for row in data: for val in row: __________: s += val print(s) Snippet-2s = 0 i = 0 while i 3: s += data[i][j] j += 1 i += 1 print(s) Which of the following conditions, when filled in the blanks in both snippets, will give the correct result?
Snippet 1: if element % 2 == 0 and element > 3: Snippet 2: i > len(data[j]
Snippet 1: if element % 2 != 0 and element > 3: Snippet 2: i < len(data[j]
Snippet 1: if element % 2 == 0 and element > 3: Snippet 2: j < len(data[i]):
Snippet 1: if element % 2 == 0 and element Snippet 2: j > len(data[i]):