Crafting histograms on a November morning.
2 | **
4 | ****
8 | ********
16 | ****************
24 | ********************************
36 | ****************************************************************
How to craft histograms in ASCII with one liners? What representations are possible?
[x**2 for x in range(1, 10)]
Multiplying the start
value of range()
returns an error:
>>> print("\n".join(["*" for i in range(4 * i)]))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'i' is not defined