Skip to content

Instantly share code, notes, and snippets.

@PANDATD
Last active July 31, 2021 15:20
Show Gist options
  • Select an option

  • Save PANDATD/7b58b0597f68ea691c32bf46001fa235 to your computer and use it in GitHub Desktop.

Select an option

Save PANDATD/7b58b0597f68ea691c32bf46001fa235 to your computer and use it in GitHub Desktop.
important funcations in python
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