view pylearn/datasets/embeddings/percent.py @ 1223:621e03253f0c

mini-bug in taglist
author boulanni <nicolas_boulanger@hotmail.com>
date Wed, 22 Sep 2010 15:08:39 -0400
parents 798607a058bd
children
line wrap: on
line source

def percent(a, b):
    """
    Return percentage string of a and b, e.g.:
        "1 of 10 (10%)"
    """
    assert a <= b
    assert a >= 0
    assert b > 0
    return "%s of %s (%.2f%%)" % (a, b, 100.*a/b)