I have a issue with setting up a dictionary to produce all the bases.

Here is the code:

 n = range(37)[2:37]

D = [[(Integer(j).str(base = n[i]),j) for j in range(len(n)+1)] for i in 
range(35)]


output:

[[('0', 0), ('1', 1),...,('100010', 34), ('100011', 35)] , [('0', 0), ('1', 
1), ('2', 2),...,('1021', 34), ('1022', 35)] , ...


when I want it to output as this:

[[('0', 0) , ('1', 1)], [('0', 0) , ('1', 1) , ('2', 2)], [('0', 0) , ('1', 
1) , ('2', 2) , ('3', 3)],...]


I was thinking that I need to add in len(n[i])+1 for the j term in the for 
loop instead of len(n)+1. Here is the error I get when I tried it out.


error:

---------------------------------------------------------------------------
TypeError Traceback (most recent call last)

/home/nooniensoong97/<ipython console> in <module>()

TypeError: object of type 'int' has no len() 

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to