python3 filter method code example
Example: what are filters in python
In simple words, the filter() method filters the given iterable
with the help of a function that tests
each element in the iterable to be true or not.
Filter Methods is simply a like comprarator class of c++ STL
Code Explanation:
# A simple tutorial to show the filter
# methods in python
grades = ['A','B','C','F']
def remove_fails(grades):
return grades!='F'
print(list(filter(remove_fails,grades)))