Quiz on classes ... losing my mind here



I'm taking this quiz which holds me back from finishing the course. See the question below. My logic says print out all x squared and divided by 3 that are less than 5 at the same time. That means option number one is out of question. Option number two can't be the answer 'coz can't see the math there. Same goes for the rest. What I'm missing ? I tried to click on answers randomly just to get this over with but seems like I can't hit the correct one on random.

What will the following print to the console?

my_list = range(10)
print filter(lambda x: x**2 / 3 < 5, my_list)


A)  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
B)  [0, 1, 2]
C)  [0, 1, 2, 3, 4]
D)  [0, 1, 2, 3]


Not sure what you mean by that, but it sounds like you need to sort out which things you know what they do and which you don't, and then you'd know what to look at. So what's involved there? range, filter, lambda, the expression in the lambda. Where's the problem?


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