+ 6

What is the error..It is showing in line 18..

https://code.sololearn.com/cPrQ7Md1KcnI/?ref=app

22nd Nov 2019, 7:47 PM
Sparshika
Sparshika - avatar
5 Answers
+ 3
As far as I understand, Your program does the calculations correctly, but you have problems with the display. To improve the quality of the display, I removed the text when entering and slightly corrected the printing in the loop. Total we have: def diagonal(lst): print("Both diagonals") for i in range(len(lst)): for j in range(len(lst[i])): if i == j or (i + j) == len(lst) - 1: print(' ' * j, lst[i][j], end='', sep='') print() def show(lst): print("Given") for i in range(len(lst)): for j in range(len(lst[i])): print(lst[i][j], end=' ') print() lst=eval(input()) show(lst) print('-' * 25) diagonal(lst) In this Case, you need to submit a matrix of numbers to the Program. For example:[[1, 2, 3], [4, 5, 6], [7, 8, 9]].
23rd Nov 2019, 9:18 AM
Rustam
Rustam - avatar
+ 8
actually we have to print diagonal of 123 456 789 as 1 3 5 7 9 in this way
23rd Nov 2019, 2:54 AM
Sparshika
Sparshika - avatar
+ 6
Thanks a lot Rustam Yusupov Thanks for your help..😀😀😀😊😊😊😊
23rd Nov 2019, 9:21 AM
Sparshika
Sparshika - avatar
+ 1
I apologize for possible errors in the text, as I use a translator.
23rd Nov 2019, 9:19 AM
Rustam
Rustam - avatar
0
Could you give me those inputs where the error occurs?
22nd Nov 2019, 8:51 PM
Rustam
Rustam - avatar