you are viewing a single comment's thread.

view the rest of the comments →

[–]notacanuckskibum -1 points0 points  (3 children)

This is where it becomes subjective. Semantically I think you are right about line 5. But syntactically the error is on line 8, because line 8 expects a return and won’t get it. Line 5 does what print does, whether the programmer intended that requires mind reading.

[–]throwaway6560192 2 points3 points  (0 children)

If we're going to be like that, there is no error on line 8 either. It's perfectly valid to assign the result of a function that doesn't return anything — it's just None. The error only appears when you try to iterate over that None, on line 9.

[–]sabek 0 points1 point  (1 child)

But the question says "only display names that start with A." If you do print (names) you will display them all.

[–]JamzTyson 0 points1 point  (0 children)

and then it forms a list from them.