Revision 11 as of 2006-03-09 13:39:54

Clear message

Powerful Python One-Liners

This is a page that is devoted to short programs that can perform powerful opperations. The ability to write short programs that are just as powerful as a program written in another lanuage designed to do the same thing. However, it is sometimes fun to try and write a program in Python that is only one line. In other lanugages this would be nearly impossible, but in Python it is a lot easier to do. The trick is to think up something that will "do a lot with a little." I, personally, would love to see this page expanded to the point where it needs some sort of organization system.

Thanks for Your Code, ["JAM"]

Contributed Code

BR Some thoughts by ewo:

import pprint;pprint.pprint(zip(('Byte', 'KByte', 'MByte', 'GByte', 'TByte'), [(2**10)**i for i in xrange(15)]))

import pprint;pprint.pprint(["%i Byte = %i Bit = largest number: %i" %(j, j*8, 256**j) for j in [2**i for i in xrange(8)]])

Cute, isn't it?

Unable to edit the page? See the FrontPage for instructions.