aboutsummaryrefslogtreecommitdiff
path: root/challenge-033/orestis-zekai/python/table.py
blob: cfe9e7f25ad0b6372e000ddab69017f4b12a1b38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Formatted Multiplication Table

numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
line1 = ' x |   1   2   3   4   5   6   7   8   9  10  11'
line2 = '---+--------------------------------------------'

print(line1)
print(line2)


for i in range(1,12):
	# Print left column number
	if (i < 10):
		print(' ' + str(i), end=" ")
	else:
		print(i, end=" ")
	print('|', end=" ")

	for j in range(0, i):
		print("   ", end=" ")
	for j in range(i, 12):
		if (i*j < 9):
			print(str(i*j) + '   ', end="")
		else:
			print(str(i*j) + '  ', end="")
	print('\n')