Bug in 18, Lambda Expressions


#1



Replace this line with your code.


Does anyone know what to do about this?


I am getting the correct output, yet codecademy is rejecting it.


#2

@byteplayer58330 ,

Codecademy wants you to assign the result of the filter call to a variable named message, and then to display the value of message.


#3

So if you didn't got it yet, your filter() must be stored to a variable called 'message', so it looks like
message = filter( lambda statement )


#4

Can someone explain to me why x!="X" does remove all X's?


#5

Hi, @acrodan ,

The filter function uses the function that is given to it as its first argument to test each component of the iterable object that is given as its second argument. In the current case, the lambda function checks each character in garbled using this test ...

x != "X"

... where the variable, x, represents the character. For each character that is not equivalent to "X", the lambda returns True, and therefore the filter function includes that character in the solution. All characters for which the test returns False, namely ones that are equivalent to "X", are excluded, by filter, from the solution.


#6

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