Skip to main content
Ask a Question
Python
Asked a question 8 months ago

Given m and n, swap the mth and nth rows of the 2-D NumPy array given below. m=int(input()) n=int(input()) a[[m,n]] = a[[n,m]] <---- # swapping print(a) # i can't understand line 4 since it has bracket [ ] inside [ ] . # i know how to do this one a[m,n] but don't know about a[[m,n]] . # can anyone explain briefly

Fuel your ambition, discover your passion and achieve your professional goals with LetsUpgrade.
Sign Up Now