问题
I have written a code and i have to verify it on the online compiler for this purpose. But that compiler is showing following error.Attaching the image
Also my code is as follows:
def matrixflip(m,d):
n=m
x=len(n[0][0:])
if(d=="h"):
for i in range(len(n)):
for j in range(x-1):
temp=n[i][j]
n[i][j]=n[i][j+1]
n[i][j+1]=temp
print(n)
elif(d=="v"):
temp=[]
for i in range(len(n)-1):
temp=n[i][0:]
n[i][0:]=n[i+1][0:]
n[i+1][0:]=temp
print(n)
else:
print(m)
myl=[[1,2],[3,4]]
matrixflip(myl,"h")
Please answer what should i do.
来源:https://stackoverflow.com/questions/54774723/showing-side-effect-error-in-some-python-complilers-for-matrixflip-function