Last active
May 2, 2016 18:56
-
-
Save reeddunkle/58e2d9bdb7b41cd3cb796d362964e64c to your computer and use it in GitHub Desktop.
Custom Filter Method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def my_filter(function, iterable): | |
| output = [] | |
| for item in iterable: | |
| if function(item): | |
| output.append(item) | |
| return output | |
| numbers = range(1, 100) | |
| print(my_filter(lambda x: x % 2 == 0, numbers)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment