+ 2
neponemayu nichego chto proishodit
the program should output the sum of the maxima of each row of the 2x2 matrix. how should the last lines be written so that it is more clear what is happening? https://code.sololearn.com/cWSzDO06egS6/?ref=app
5 Antworten
+ 3
sum = 0
max = 0
for row in a:
#for i in range(0, n):
#if a[i][j] >= max:
#max = a[i][j]
sum += max(row)
print(sum)
+ 3
sum = 0
max = 0
for row in a:
max =0
for num in row:
if num >= max:
max = num
sum += max
print(sum)
+ 1
Thank you very much!!!🌺
0
unfortunately I am forbidden to use the max () function
0
so many mistakes. for row in a: but a isn’t defined. no variable for a. Next is sum+= max. you used a wrong indentation and so on