Guest User

Untitled

a guest
Dec 7th, 2019
90
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from random import randint
  2. from functools import reduce
  3.  
  4. print('Даны две действительные квадратные матрицы порядка n.')
  5. n = x = y = k = o = int(input('Введите порядок n:'))
  6. print('Первая матрица.')
  7. a = [[randint(0, 150) for i in range(x)] for j in range(y)]
  8. for i in a:
  9.     print(i)
  10. print('Вторая матрица.')
  11. b = [[randint(0, 150) for k in range(x)] for o in range(y)]
  12. for k in b:
  13.     print(k)
  14.  
  15. c = []
  16. print('Третья матрица.')
  17. for i, s in enumerate(a):
  18.     c.append([*map(lambda x: x * max(b[i]), s)])
  19.  
  20. for k in c:
  21.     print(k)
  22.  
  23. d = []
  24. print('Четвертая матрица.')
  25. for i, s in enumerate(a):  
  26.     d.append([])
  27.     for s1 in s:
  28.         d[i].append(s1 + reduce(lambda x, y: x * y, b[i]))
  29.        
  30.  
  31. for k in d:
  32.     print(k)
RAW Paste Data