def plot(data):
    """
    Histogram data to stdout
    """
largest = max(data)
scale = 50.0 / largest
for i, datum in enumerate(data):
    bar = '*' * int(datum * scale)
print('%2d: %s (%d)' % (i, bar, datum))
data = [random.randrange(100) for _ in range(20)]
Histogram without plotting function