Lambda Expressions--bug in checker?


#1

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

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

In the console, it clearly prints, "I am another secret message!" then None. I cannot get the system to recognize that it is actually printing what was asked for.

garbled = "IXXX aXXmX aXXXnXoXXXXXtXhXeXXXXrX sXXXXeXcXXXrXeXt mXXeXsXXXsXaXXXXXXgXeX!XX"
print filter(lambda x: x != "X", garbled)

I even tried testing it by commenting out the line of code I wrote and putting 'print "I am another secret message!"' and it still throws the same error.

Ideas?
Thanks for any help,
Lynn


#2

It seems like a glitch, Refresh and submit again!


#3

you need to store the result of filter in a variable named message and then print message


#4

It worked without saving it to a variable,(i just tested it).


#5

I shall do that, but it is unnecessary. I ran it in my installation of Python on my machine and it works the same way that it does in the console.

Update: after storing the filter in var message, and printing message, it works. When Codecademy specifies message in a little button, I will make sure and make a message.

Thanks, all!!
Lynn


#6

Weird, It worked for me without/with defining the variable! (maybe cus I already passed it)


#7

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