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range(y)]
|
|
for i in range(x):
|
|
for j in range(y):
|
|
print("x: {}, y: {}\n".format(i, j))
|
|
a = input("value: ")
|
|
A[j][i] = a
|
|
return A
|
|
|
|
|
|
def random_part():
|
|
n = randint(1, 4)
|
|
if n == 1:
|
|
X = A
|
|
if n == 2:
|
|
X = B
|
|
if n == 3:
|
|
X = C
|
|
if n == 4:
|
|
X = D
|
|
X = array(X)
|
|
m = randint(0, 1)
|
|
if m == 1:
|
|
X = flipud(X)
|
|
o = randint(0, 1)
|
|
if o == 1:
|
|
X = fliplr(X)
|
|
return X
|