In this lesson, you’ll learn that filter() is one of the functional programming primitives (or building blocks) available in Python and that it’s useful in a number of contexts.
You’ll see how you can use filter() to play with your data set. You’ll write a filter expression to see which items in your data set meet particular criteria. filter() takes another function object, and you can define a function object inline with lambda expressions.
Dan Bader RP Team on Aug. 18, 2020
@kiran: You’re printing the
Scientistclass. To get a nice string representation of aScientistinstance you need to create aScientistobject first:Output:
Check out our “Object-Oriented Programming (OOP) With Python” Learning Path to learn more about OOP in Python and the difference between classes and instances/objects.