wikiacademia

site

cute tricks

From Josh, Sep 2006. The ^ operator is "exclusive or"
$ python # or other language of your choice >>> a,b = (27, 14) >>> a = a ^ b >>> b = a ^ b >>> a = a ^ b >>> a,b (14, 27)
No extra storage needed...

http://cs.marlboro.edu/ courses/ marlboro_wiki/ cute_tricks
last modified Tuesday September 19 2006 12:48 pm EDT