Last active
July 31, 2021 15:20
-
-
Save PANDATD/7b58b0597f68ea691c32bf46001fa235 to your computer and use it in GitHub Desktop.
important funcations in python
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
| import functools | |
| # Filter Funcation | |
| _filter = '''The Filter is pythons inbuild funcation, | |
| Which will be use for filter the data for itrables such as list | |
| [Syntax] | |
| filter(funcaion, *itreables) | |
| [Example] | |
| is_positive(a: any): | |
| return a > 0 | |
| answer = list(filter(is_positive,[1,2,3,4,-5,-6])) | |
| print(answer) | |
| [Output] | |
| [1,2,3,4] | |
| ''' | |
| print(_filter) | |
| def is_positive(a): | |
| return a > 0 | |
| answer = list(filter(is_positive, [1,2,3,4,-5,-6])) | |
| print(f'The output of followinig Opretion is: {answer}') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment