Answer the question
In order to leave comments, you need to log in
Why is None returned?
I tried to make a function to shift the array (its length is always 4) to the right by n units, but for some reason, None is returned instead of the shifted array. What's wrong?
m = [1,2,3,4]
def f(a,n):
t = [0,1,2,3]
t[0] = a[3]
t[1] = a[0]
t[2] = a[1]
t[3] = a[2]
r = False
if n == 1:
return a
f(t,n-1)
k = f(m,2)
print(k)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question