БГ
Size: a a a
БГ
R3
k
K
БГ
AM
E
A
matrix_from = int(input("От:"))
matrix_to = int(input("До:"))
matrix = range(matrix_from, matrix_to+1)
maxlen = len(str(max(matrix)**2))
result = []
for i in matrix:
rowstring = []
for k in matrix:
rowstring.append(f"{k*i}".ljust(maxlen))
result.append("|".join(rowstring))
print("\n".join(result))БГ
E
E
R3
БГ
AT
_ |1|2|3
1 |1|2|3
2 |2|4|6
def matmul(n):
r = range(1, n + 1)
w = len(str(n ** 2))
t = f"{{:>{w}}}"
left = t + '|'
res = left.format('_') + '|'.join(t.format(x) for x in r) + '\n'
res += '\n'.join(left.format(y) + '|'.join(t.format(x * y) for x in r) for y in r)
return res
R3
def matmul(n):
r = range(1, n + 1)
w = len(str(n ** 2))
t = f"{{:>{w}}}"
left = t + '|'
res = left.format('_') + '|'.join(t.format(x) for x in r) + '\n'
res += '\n'.join(left.format(y) + '|'.join(t.format(x * y) for x in r) for y in r)
return res
R3
AT
R3
R3
def matmul(n):
r = range(1, n + 1)
w = len(str(n ** 2))
t = f"{{:>{w}}}"
left = t + '|'
res = left.format('_') + '|'.join(t.format(x) for x in r) + '\n'
res += '\n'.join(left.format(y) + '|'.join(t.format(x * y) for x in r) for y in r)
return res