Anonymous user
Multiplication tables: Difference between revisions
→{{header|Python}}
Line 333:
=={{header|Python}}==
<lang python>>>> size = 12
>>> width = len(str(size**2))
>>> for row in range(-1,size+1):
if row==0:
print("─"*
else:
print("".join("%
else (row,"│") if row>0 and col==0
else (col,"") if row==-1
else ("","") if row>col
else (row*col,"")))
for col in range(size+1)))
Line 364 ⟶ 365:
Declaring a file type of UTF-8 and adding a u to all string literals to transform them into Unicode literals would make the above work in Python 2.X.
<small>(As would using ASCII minus, plus, and pipe characters: "-", "+", "|"; instead of the non-ASCII chars used to draw a frame)</small>.
=={{header|Ruby}}==
|