Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # any_in_array.py - no ORs'ing around! (inside humor)
- # Note: tuples and lists are read as sets. Also, instead of 'in' it's '&'
- a = (1,2,3,4,5,'target',6,7,8,9,10)
- b = [100,200,'target',300,400,500]
- c = [100,200,300,400,500]
- def areAnyInList(first_array,second_array):
- print "In",first_array,'\nand',second_array
- if set(first_array) & set(second_array):
- print 'an identical item value has been found'
- else:
- print 'none are identical'
- print '\n'*4
- #
- areAnyInList(a,b)
- areAnyInList(a,c)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement