×

# How to get rid of NZEC error in Python?

 0 for item in range(int(input())): a,b=map(int,input().split()) s='^'.join([str(i) for i in list(range(a,b+1))]) if eval(s)%2==0: print('Even') else: print('Odd') Whats wrong in this code? showing the runtime error asked 10 Feb, 17:07 1 accept rate: 0%

 0 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. answered 10 Feb, 19:05 5★vichitr 255●5 accept rate: 11%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×26
×14