[PENDING] Update solution code to python 3 in Lambda Functions DS Path

Link to python module:

print statement is python 2.7. ie:

contains_a = lambda word: "a" in word

print contains_a("banana")
print contains_a("apple")
print contains_a("cherry")

To update to most recent version of python, change to:


Same for slide 3, etc.
update to:

long_string = lambda str: len(str) > 12


Yeah, seems weird that the explainer text is Py3 but the interpreter behind the scenes is Py2.x

I’ll ask about it. :slight_smile:


I noticed that too! :smiley_cat:

1 Like

Is this section supposed to be in python3? I don’t remember it being part of the learn Python3 course or is it a case of previous lessons used python3 but this one forces you to use 2.7?

It’s part of the Data Science path. The 2.7 solution works. I was just pointing it out for consistency bc the instructions are in Py3.
And when I plug the code into Colab, I get an error…bc it’s 2.7.

I’ve run trhough these lessons but not the full path so I wasn’t sure what you meant but then the next page had print(len("Hello, world!")) on it so it does seem a little scattered (apologies if that’s not what you meant). Perhaps having the import statement for the print function would make it more obvious the interpeter is running python2.