I want to use the below code (am supposed to not use map(), for an online programming site as gives error on that of : TypeError: 'map' object is not subscriptable ):
arr[i][j] = [int(input("Input score").strip().split()[:l]) for j in range(n) for i in range(t)]
instead of the below working version:
for i in range(t):
for j in range(n):
arr[i][j] = map(int, input("Input score").strip().split())[:l]
but the error is (assume so) based on providing a list instead of individual values, as stated below:
TypeError: int() argument must be a string or a number, not 'list'
Unable to find a solution by any alternate way, say convert rhs (of desired soln.) to a string in first step & then assign to lhs in the second step; as need assign to arr[i][j].
P.S. Need to make the solution use the individual and row-wise values of arr, as say need find row-wise sum of values or even individual values. The below code uses the row-wise arr values to fill up total.
for i in range(t):
for j in range(n):
# Find sum of all scores row-wise
sum = 0
for m in arr[i][j]:
sum += m
total[i][j] = sum