import random
n = []
x = random.randint(2,7)
y = x + random.randint(2,5)
a = [[random.randint(-20, 20) for i in range(x)] for j in range(y)]
b = [[random.randint(-20, 20) for i in range(x)] for j in range(y)]
print('Случайная матрица: ')
for i in a:
for j in i:
print('|', j, end=' ')
print('|')
b = zip(*a)
print('Транспонированная матрица: ')
for i in b:
for j in i:
print('|', j, end=' ')
n.append(i[::2])
print('|')
print(n)
n.append(i[1])
print (n)
n.append(i[::2])
print(n)