Ben Bacarisse wrote:
Think functional!  This is 257 characters:

250 chars, 17 shorter than the text it produces:

a=[];o=[];n=[];A=list.append
for b in range(3,-1,-1):
x=bool(b>>1);y=bool(b&1);A(a,"%s and %s is %s"%(x,y,x and y));A(o,"%s or %s is %s"%(x,y,x or y))
 if x:A(n,"not %s is %s"%(y,not y))
print("    Boolean Operators\n"+"-"*24+"\n"+"\n".join(a+o+n))

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to