Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. def bitxor(a, b):
  2.     if isinstance(a,int) and isinstance(b,int):
  3.         return a ^ b
  4.     elif isinstance(a,int) and isinstance(b,list):
  5.         return [a ^ i for i in b]
  6.     elif isinstance(a,list) and isinstance(b,list):        
  7.         if len(a) != len(b): return None
  8.         else: return [a[i] ^ b[i] for i in range(0,len(a))]
  9.     else:
  10.         return None
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement