Calling the length of a list of inequality strings result in an error
I wonder if this is a bug
sign=['>=', '<=', '=']
m1=[1 if (v=="<=" or v==">=") else 2 for v in sign]
m1
The len(m1)
is defined but
y=var('y_',n=range(len(m1)))
return the error '>' not supported between instances of 'range' and 'int'
Note that
len(m1)
will be the same aslen(sign)
. Do you want the length ofm1
or the number of distinct elements or the actual distinct elements? For the last of these, you could usevar(['y_{}'.format(i) for i in set(m1)])
.