I want to find out whether two numbers N1 and N2 are the permutations of the same digits. For example 123 and 321
You need to define the arrays in the functions. And then append to it. arr1 = [] defines an empty array.
arr1[k] = 2
tries to change the value at index k.
So either you should initialise it to a certain size or append to the empty array (using the append function).
Also, if you want to access the arrays from outside the function, you might want to return the arrays from the function