a = []
for index in range(52):
a.append([])
for jindex in range(52):
a[index].append('a')
row,col = [int(x) for x in input().split(" ")]
b = []
for index in range(row):
str = input()
for jindex in range(col):
a[index+1][jindex + 1] = str[jindex]
if(str[jindex] == 'A'):
b.append([index,jindex])
#print (a)
# print (b)
ans = max(trav(x[0],x[1]) for x in b
The last line is troublesome, trav(r,c) is a function that return integer values.
I just want to ask is this usage correct? I am very new to python.
I tried to extend this line from row,col = [int(x) for x in input().split(" ")]
I am trying to store the max value the function trav returns for each list of 2 items stored in the list b.
Like: if the list b is [[10, 20], [2, 3]]
and lets say the func trav returns the sum of the 2 items in the sublist.
then the first sub list gives us 30, and then second gives us 5. So ans should have a value 30