how to input in loop code example
Example: taking input in for loop in python
n, m = list(map(int, input().split()))
arr = []
for _ in range(n):
l = list(map(int, input().split()))[:m]
arr.append(l)
n, m = list(map(int, input().split()))
arr = []
for _ in range(n):
l = list(map(int, input().split()))[:m]
arr.append(l)