/
76.py
66 lines (45 loc) · 1005 Bytes
/
76.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import random
N = 4
M = 5
K = 2
def get_row(column):
col = []
for i in range(0, column):
col.append(random.randint(0, 9))
return col
def get_matrix(row, column):
matrix = []
for i in range(0, row):
matrix.append(get_row(column))
return matrix
def print_matrix(matrix):
i = 0
while i < len(matrix):
j = 0
row = matrix[i]
while j < len(row):
column = row[j]
print(column, end=' ')
j += 1
print()
i += 1
def get_column(matrix, index):
column = []
i = 0
while i < len(matrix):
column.append(matrix[i][index])
i += 1
return column
A = get_matrix(N, M)
print("Исходная матрица:")
print_matrix(A)
k_column = get_column(A, K - 1)
i = 0
while i < len(A):
j = 0
while j < len(A[i]):
A[i][j] *= k_column[i]
j += 1
i += 1
print("Моифицированная матрица:")
print_matrix(A)