Have an unusual request regarding code implementation at ideone:
n = 42
new= []
m = 0
def convert(n,m):
print "round #:", m,"n :", n
a = ((n+1) % 3)-1
if n:
new.append(a); print 'new :', new
print 'call convert(' (n+1)//3,',',m+1,'):',convert((n+1)//3,m+1)
print 'after convert(' , n, ',' ,m, ')','\n'
else:
print 'n==',n, 'new: ::: ', new,'\n\n',
return new, n
print convert(n,m), "<<---- None returned ? "
I don't know why 'None' is printed in the output below. The output 'None' is printed in two places (cases):
Case #1. print 'after convert(' , n, ',' ,m, ')','\n'
Case #2. print convert(n,m), "<<---- None returned ? "
I am not at all clear why if the default case of 'n=0' has proper value of list 'new', then how is it that in case #2, 'None' is returned.
According to me, 'new' contents should be printed in case #2.
Even more confusing is: why case #1 is returning 'None' each time for non-zero value of 'n'?
According to me, there should be no 'None' printed for case #1.