How to get rid of NZEC error in Python?

for item in range(int(input())):
s=’^’.join([str(i) for i in list(range(a,b+1))])
if eval(s)%2==0:
Whats wrong in this code? showing the runtime error

One possible reason is the difference between a and b is too much and you are not able to allocate this much of memory. You can’t have a string of size more than 10^8. But if a =1 and b = 10^9 then it’s surely going to give such error. Check the constraint on a, b. Good approach can be this.