18 Lambda Expressions


#1



https://www.codecademy.com/courses/python-beginner-en-KAgt5/4/4?curriculum_id=4f89dab3d788890003000096


I receive the following error:

Oops, try again. It looks like your message is "I am the secret message!" instead of "I am another secret message!"

I don't understand why my code is returning 'the' instead of 'another'


garbled = "IXXX aXXmX aXXXnXoXXXXXtXhXeXXXXrX sXXXXeXcXXXrXeXt mXXeXsXXXsXaXXXXXXgXeX!XX"

message == filter(lambda x: x == 'X', garbled)

print message


#2

HI this line

message == filter(lambda x: x == 'X', garbled)

first after message you should = instead of == because you want to save the filter() inside message and not compare it..
then this part

x == 'X'

in this case it will print all the X instaed of the others letter


#3

Thank you so much, :slight_smile: that worked perfectly


#4

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