Even Or Odd Batch

Even Or Odd Batch

Easy Python Loops 13 views
Explanation Complexity

Problem Statement

Read t integers. Output EVEN if number is even else ODD for each testcase.

Input Format

First integer t. Next t integers.

Output Format

t lines (EVEN/ODD).

Example

5
1
2
3
10
-7
ODD
EVEN
ODD
EVEN
ODD

Constraints

1

Input / Output Format

Input Format
First integer t. Next t integers.
Output Format
t lines (EVEN/ODD).
Constraints
1

Examples

Input:
5 1 2 3 10 -7
Output:
ODD EVEN ODD EVEN ODD

Example Solution (Public)

Python
import sys
p=sys.stdin.read().strip().split()
if not p:
  sys.exit(0)
it=iter(p)
t=int(next(it))
out=[]
for _ in range(t):
  try:
    x=int(next(it))
    out.append('EVEN' if x%2==0 else 'ODD')
  except Exception:
    out.append('ODD')
sys.stdout.write('\
'.join(out))

Official Solution Code

import sys
p=sys.stdin.read().strip().split()
if not p:
  sys.exit(0)
it=iter(p)
t=int(next(it))
out=[]
for _ in range(t):
  try:
    x=int(next(it))
    out.append('EVEN' if x%2==0 else 'ODD')
  except Exception:
    out.append('ODD')
sys.stdout.write('\
'.join(out))
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.