I have a tasko to make a program in which i get m, n and k. I should create a list a with n*m
element.
List b
is supposed to have n*m
element. It is created from list a with cyclic shift k to the right for m elements of lists.
I know it is poorly explained. Example is:
n=3
m=4
A=1 2 3 4 5 6 7 8 9 10 11 12
k=1
B=4 1 2 3 8 5 6 7 12 9 10 11
What i have at the moment is:
from random import randint
n = int(input())
m=int(input())
A = []
B=[0]
B=B*n*m
for i in range(n*m):
A = A + [randint(1, 30)]
print('\nLista A:\n')
for i in range(n*m):
print(A[i], end = ' ')
print()
k=int(input())
for i in range(-1, m*n, m):
B[m-1-i]=A[i]
print(B[m-1-i])
print('\nLista B:\n')
for i in range(n*m):
print(B[i], end = ' ')
Thanks