I'm getting this strange error trying to run a script, the code appears to be correct but it seems python (3) didn't liked this part:
def function(x):
if integer:
return int(x)
else:
return x
non_nil = randrange(21)
d = dict([(randrange(101), Racional(coeff(randrange(-20,20)),
coeff(choice(range(-30,0)+\
range(1,30)))))
for k in range(non_nil)])
And i get the following error:
for k in range(non_nil)]) unsupported operand type(s) for +: 'range' and 'range'
I already tried to put the last four lines in a single one but python returns the same error.
range(-30, 0) + range(1, 30)
? Why notrange(-30, 30)
? – Amphibolite