Why is This Code Not Passing?


Why is it not taking this code:

test = [1, 2, 3]

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

What’s wrong?

FAQ: Learn Python- Loops - Create your own

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.