Gives me 'SyntaxError: invalid syntax' on the name of a list (a)?


#1

https://www.codecademy.com/courses/learn-python/lessons/a-day-at-the-supermarket/exercises/control-flow-and-looping?action=lesson_resume&link_content_target=interstitial_undefined

^ Link for the exercise.

Here’s the code (the exercise gave me the list)

a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]

for number in a
  if number % 2 == 0
    print number

It gives me a syntax error, saying that a is an invalid syntax.


#2

Missing colon to denote a new block.

Likewise.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.