odd question

Dan Bishop danb_83 at yahoo.com
Thu Jul 15 04:54:05 CEST 2004


"Heike C. Zimmerer" <usenet04q1 at hczim.de> wrote in message news:<2llihbFds2pbU1 at uni-berlin.de>...
> "Karl Pech" <KarlPech at users.sf.net> writes:
> 
> > I'm currently working on the following exercise:
> > ---
> > You have given the following function:
> > def f2(i, j, k):
> >   return ((i | j) & k) | (i & j)
> >
> > Find a useful utilization for this function.
> > ---
> 
> Depending on k, you either get i & j or i | j.  It is left as an
> exercise to find out why.  Don't know if it's really useful, however.

It's useful in digital logic: It represents the carry-out from a full
adder.  Of course, Python already has a perfectly good + operator.



More information about the Python-list mailing list