Number 3


#1

help me please

my code is this:

a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
for numbers in a:
if a % 2 == 0
print number

but it wont let me continue.


#2

This question says to print even numbers from list.
You probably not indenting your code properly.
When a new block starts You have to indent it by fours spaces.

Lets Dissect your code and see what faults you made..

First block is for statement.

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

You have missed the colon after if.
You also tried to divide a [which is list] but you should check if number / item of a is even or not.
You used numbers (Iteration variable) for loop iteration but you're using number (iteration variable) instead.

if number % 2 == 0:

Colon basically indicates the start of new block.

if number % 2 == 0:
        print number

#3

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