import itertools
N = 4
print("The dimension : " + str(N))
temp = itertools.count(1)
res = [[next(temp) for i in range(N)] for i in range(N)]
print("The created matrix of N * N: " + str(res))
Solve Problems by Coding Solutions - A Complete solution for python programming
import itertools
N = 4
print("The dimension : " + str(N))
temp = itertools.count(1)
res = [[next(temp) for i in range(N)] for i in range(N)]
print("The created matrix of N * N: " + str(res))
from functools import reduce
def find_remainder(arr,n):
sum_1=reduce(lambda x,y: x*y,arr)
remainder=sum_1%n
print(remainder)
arr=[100,10,5,25,35,14]
n=11
find_remainder(arr,n)