D. None of the above
20. What will be the output of the following Python
code?
list1 = [3 , 2,5,6,0,7,9)
sum = 0
sum1 = 0
for elem in list1:
if (elem % 2 == 0);
sum = sum + elem
continue
if (elem % 3 == 0):
sum1 = sum1 + elem
print(sum, end="")
print(sum1)
(1 Point)
Answers
Answered by
0
Answer:
please follow me
and Mark me as brainleast
Answered by
0
Output:
8
12
Here, the "for" loop is used to take each number from the list one at a time. there are 2 if statements inside the loop one is for checking the number is divisible by 2 and another number is divisible by 3.
Now,
the sum of the number divisible by 2 will be one output and
the sum of the number divisible by 3 will be the other output.
Similar questions
Math,
2 months ago
Chemistry,
2 months ago
English,
5 months ago
English,
10 months ago
Social Sciences,
10 months ago