A

Admin • 828.03K Points
Coach

Q. What will be the output of the following Python code?

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)
  • (A) 8 9
  • (B) 8 3
  • (C) 2 3
  • (D) 8 12
  • Correct Answer - Option(D)
  • Views: 8
  • Filed under category Python
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.