Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # if_any_or_all_in_string.py
- elements = ['one', 'two', 'three']
- def oAny(z):
- print z
- print any(TrueFalse in z for TrueFalse in elements)
- print
- oAny('abc 123 xyz')
- oAny('abc one 123 two xyz three')
- oAny('abc 123 two xyz')
- def oAll(z):
- print z
- print all(TrueFalse in z for TrueFalse in elements)
- print
- oAll('abc 123 xyz')
- oAll('abc one 123 two xyz three')
- oAll('abc 123 two xyz')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement