card 1 of 10

A = [-1,0,2,-2,4,0,1]

Accum = []

for x in A:

if x<1:

pass

Accum += x

print(Accum)

concatentation only works when types are same

TypeError: cannot concatentate list with int

card 2 of 10

A = [-1,0,2,-2,4,0,1]

Accum = []

for x in A:

if x<1:

pass

Accum += [x]

print(Accum)

pass does nothing

[-1, 0, 2, -2, 4, 0, 1]

card 3 of 10

A = [-1,0,2,-2,4,0,1]

Accum = []

for x in A:

if x<1:

pass

else:

Accum += [x]

print(Accum)

pass does nothing

[2, 4, 1]

card 4 of 10

A = [-1,0,2,-2,4,0,1]

Accum = []

for x in A:

if x<1:

Accum += [x]

else:

pass

print(Accum)

pass does nothing

[-1, 0, -2, 0]

card 5 of 10

A = [-1,0,2,-2,4,0,1]

Accum = []

for x in A:

if x<1:

continue

else:

Accum += [x]

print(Accum)

continue goes on immediately to next iteration

[2, 4, 1]

card 6 of 10

A = [-1,0,2,-2,4,0,1]

Accum = []

for x in A:

if x<1:

continue

Accum += [x]

print(Accum)

continue goes on immediately to next iteration

[2, 4, 1]

card 7 of 10

A = [-1,0,2,-2,4,0,1]

Accum = []

for x in A:

if x<1:

Accum += [x]

break

print(Accum)

break ends all iterations

[-1]

card 8 of 10

A = [-1,0,2,-2,4,0,1]

Accum = []

for x in A:

if x<1:

Accum += [x]

else:

break

print(Accum)

break ends all iterations

[-1, 0]

card 9 of 10

A = [-1,0,2,-2,4,0,1]

Accum = []

for x in A:

if x<1:

break

else:

Accum += [x]

print(Accum)

break ends all iterations

[]

card 10 of 10

A = [-1,0,2,-2,4,0,1]

Accum = { }

for x in A:

if x<1:

Accum[x] = 0

print(len(Accum))

len() for dictionary reports number of keys

3 (can't have 0 twice as key -- keys are unique, -1, 0, -2 in this case)

(use browser reload to restart this problem set)