Why is This Code Not Passing?


#1

Why is it not taking this code:

test = [1, 2, 3]

for x in test:
  if x % 2 == 0
  print even
else:
  print "odd"

What’s wrong?


FAQ: Learn Python- Loops - Create your own
#2

indent(ion) is off, indent determines nesting, so indent needs to be right.

general if syntax:

if condition:

you have the condition in your code, but not the colon (:)

also, the else is not nested in the for loop, it should be.