how this print(max(x+1,y+1,n-x,n-y)) is executed
Reverse of loop
max() is an inbuilt function in python . It is used return the maximum value passed in it . In this case
max(x+1,y+1,n-x,n-y) the expression which will have the max value will be returned.
Lets say x=0,y=0 and n=5 ,in this case the values in max function will look like-
max(1,1,5,5) amongst these values 5 is the maximum hence our max(x+1,y+1,n-x,n-y) will return 5
And using the print() function we are printing this value returned ,i.e 5
If there is a doubt about how its printing the 5 X 5 matrix using the nested loops then let me know and I will try to explain it to you.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.