Control Flow and Looping


#1



https://www.codecademy.com/en/courses/python-beginner-en-IZ9Ra/0/3?curriculum_id=4f89dab3d788890003000096#


File "python", line 4
    if item % 2 == 0
                   ^

SyntaxError: invalid syntax

I would expect it to print out even numbers, as it suggests to do in the example... What am I doing wrong?


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

for item in a:
    if item % 2 == 0
        print item


#2

That was just a typo... I forgot colon at the end of my if stament... :stuck_out_tongue:


#3

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