add without carry

Bryan Olson fakeaddress at nowhere.org
Fri Sep 15 05:54:00 EDT 2006


Hugh wrote:
> Sorry, here's an example...
> 
> 5+7=12
> 
> added without carrying, 5+7=2
> 
> i.e the result is always less than 10

Are you looking for bitwise exclusive or? In Python it's
the '^' operator. For example:

     print 5 ^ 7


-- 
--Bryan



More information about the Python-list mailing list