Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def oper(l, method="xor"):
- ops = {
- "xor" : "^",
- "or" : "|", ## All maxed warning ##
- "and" : "&", ## All 0 warning ##
- "ls" : "<<", ## Memory warning ##
- "rs" : ">>",
- "mul" : "*",
- "sub" : "-",
- "add" : "+",
- "div" : "/",
- "mod" : "%", ## By 0 warning ##
- "exp" : "**" ## Time warning ##
- }
- a = l[:]
- for k1, v1 in enumerate(a):
- for k2, v2 in enumerate(a):
- exec("a[k1] {}= a[k2]".format(ops[method]))
- return a
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement